[FFmpeg-devel] [PATCH] avcodec/snowdec: Check ld/cbd/crd

Michael Niedermayer michael at niedermayer.cc
Mon Sep 4 12:30:55 EEST 2017


On Sun, Sep 03, 2017 at 09:27:53PM -0400, Ronald S. Bultje wrote:
> Hi,
> 
> On Sun, Sep 3, 2017 at 7:54 PM, Michael Niedermayer <michael at niedermayer.cc>
> wrote:
> 
> > Its unprofessional to fail decoding a file but not provide any
> > hint as to why a failure occured.
> >
> [..]
> 
> > Our code is already quite terse and devoid of comments and
> > documentation, error messages do not seem a exception here
> 
> 
> Both of these comments assume the error message that you're trying to add
> is in any shape, way or form helpful to end users.
> 
> Unfortunately, it is not.

> 
> Imagine that j-b saw the error message (compared to the generic "invalid
> data") and ask yourself if the utility was any different (again, compared
> to the generic "invalid data"). If not, then it shouldn't be an
> AV_LOG_ERROR message displayed to end users.

To take this example
with a generic "invalid data", he knows theres an error and thats it
with the added error message he can
1. grep it in git to find out where the error occurs
2. google it to see if its a known problem with a known solution
   find a patch to fix it, a version that contains that fix,
   a bug report, a regression, ...
3. find out with git log which commit added it much quicker than
   through bisect.
4. ask about the specific error on IRC, "is this known issue? should
   i upload the file?" for example


But lets just assume for the sake of the argument, that it is useless,
can you take a look at these please:
(this is a uncut list of errors from vp9.c)

libavcodec/vp9.c:                av_log(avctx, AV_LOG_ERROR, "Reserved bit set in RGB\n");
libavcodec/vp9.c:            av_log(avctx, AV_LOG_ERROR, "RGB not supported in profile %d\n",
libavcodec/vp9.c:                av_log(avctx, AV_LOG_ERROR, "YUV 4:2:0 not supported in profile %d\n",
libavcodec/vp9.c:                av_log(avctx, AV_LOG_ERROR, "Profile %d color details reserved bit set\n",
libavcodec/vp9.c:        av_log(avctx, AV_LOG_ERROR, "Failed to initialize bitstream reader\n");
libavcodec/vp9.c:        av_log(avctx, AV_LOG_ERROR, "Invalid frame marker\n");
libavcodec/vp9.c:        av_log(avctx, AV_LOG_ERROR, "Profile %d is not yet supported\n", avctx->profile);
libavcodec/vp9.c:            av_log(avctx, AV_LOG_ERROR, "Invalid sync code\n");
libavcodec/vp9.c:                av_log(avctx, AV_LOG_ERROR, "Invalid sync code\n");
libavcodec/vp9.c:                av_log(avctx, AV_LOG_ERROR, "Not all references are available\n");
libavcodec/vp9.c:        av_log(avctx, AV_LOG_ERROR, "Failed to initialize decoder for %dx%d @ %d\n",
libavcodec/vp9.c:            av_log(avctx, AV_LOG_ERROR, "Ran out of memory during range coder init\n");
libavcodec/vp9.c:                av_log(avctx, AV_LOG_ERROR,
libavcodec/vp9.c-                       "Ref pixfmt (%s) did not match current frame (%s)",
libavcodec/vp9.c:                    av_log(avctx, AV_LOG_ERROR,
libavcodec/vp9.c-                           "Invalid ref frame dimensions %dx%d for frame size %dx%d\n",
libavcodec/vp9.c:        av_log(avctx, AV_LOG_ERROR, "Invalid compressed header size\n");
libavcodec/vp9.c:        av_log(avctx, AV_LOG_ERROR, "Marker bit was set\n");
libavcodec/vp9.c:            av_log(avctx, AV_LOG_ERROR, "Requested reference %d not available\n", ref);
libavcodec/vp9.c:        av_log(avctx, AV_LOG_ERROR,
libavcodec/vp9.c-               "Failed to allocate block buffers\n");
libavcodec/vp9.c:            av_log(avctx, AV_LOG_ERROR, "Failed to allocate frame buffer %d\n", i);
libavcodec/vp9.c:            av_log(avctx, AV_LOG_ERROR, "Failed to allocate frame buffer %d\n", i);

Many of these are exactly teh same, technically detailed error
messages at AV_LOG_ERROR level about technical details being out of
valid range.

digging deeper
ecd9f57edcb libavcodec/vp9.c       (Ronald S. Bultje    2015-09-02 14:35:03 -0400  343)                 av_log(ctx, AV_LOG_ERROR, "Reserved bit set in RGB\n");
346ce5da197 libavcodec/vp9.c       (Ronald S. Bultje    2015-05-05 09:39:13 -0400  347)             av_log(ctx, AV_LOG_ERROR, "RGB not supported in profile %d\n",
346ce5da197 libavcodec/vp9.c       (Ronald S. Bultje    2015-05-05 09:39:13 -0400  366)                 av_log(ctx, AV_LOG_ERROR, "YUV 4:2:0 not supported in profile %d\n",
346ce5da197 libavcodec/vp9.c       (Ronald S. Bultje    2015-05-05 09:39:13 -0400  370)                 av_log(ctx, AV_LOG_ERROR, "Profile %d color details reserved bit set\n",
150c5543ffe libavcodec/vp9.c       (Clément Bœsch       2013-11-15 23:26:45 +0100  393)         av_log(ctx, AV_LOG_ERROR, "Failed to initialize bitstream reader\n");
848826f527b libavcodec/vp9.c       (Ronald S. Bultje    2013-09-30 23:03:30 -0400  397)         av_log(ctx, AV_LOG_ERROR, "Invalid frame marker\n");
079b7f6eacc libavcodec/vp9.c       (James Almer         2015-05-04 18:37:50 -0300  404)         av_log(ctx, AV_LOG_ERROR, "Profile %d is not yet supported\n", ctx->profile);
848826f527b libavcodec/vp9.c       (Ronald S. Bultje    2013-09-30 23:03:30 -0400  420)             av_log(ctx, AV_LOG_ERROR, "Invalid sync code\n");
848826f527b libavcodec/vp9.c       (Ronald S. Bultje    2013-09-30 23:03:30 -0400  436)                 av_log(ctx, AV_LOG_ERROR, "Invalid sync code\n");
848826f527b libavcodec/vp9.c       (Ronald S. Bultje    2013-09-30 23:03:30 -0400  467)                 av_log(ctx, AV_LOG_ERROR, "Not all references are available\n");
1ac89869db0 libavcodec/vp9.c       (Ronald S. Bultje    2015-12-01 12:24:05 -0500  635)         av_log(ctx, AV_LOG_ERROR, "Failed to initialize decoder for %dx%d @ %d\n",
848826f527b libavcodec/vp9.c       (Ronald S. Bultje    2013-09-30 23:03:30 -0400  657)             av_log(ctx, AV_LOG_ERROR, "Ran out of memory during range coder init\n");
585083dd1fc libavcodec/vp9.c       (Hendrik Leppkes     2015-12-03 11:10:33 +0100  669)                 av_log(ctx, AV_LOG_ERROR,
585083dd1fc libavcodec/vp9.c       (Hendrik Leppkes     2015-12-03 11:10:33 +0100  678)                     av_log(ctx, AV_LOG_ERROR,
848826f527b libavcodec/vp9.c       (Ronald S. Bultje    2013-09-30 23:03:30 -0400  714)         av_log(ctx, AV_LOG_ERROR, "Invalid compressed header size\n");
848826f527b libavcodec/vp9.c       (Ronald S. Bultje    2013-09-30 23:03:30 -0400  722)         av_log(ctx, AV_LOG_ERROR, "Marker bit was set\n");
848826f527b libavcodec/vp9.c       (Ronald S. Bultje    2013-09-30 23:03:30 -0400 1282)             av_log(ctx, AV_LOG_ERROR, "Requested reference %d not available\n", ref);
af63ea7078c libavcodec/vp9.c       (Ronald S. Bultje    2014-02-08 08:24:13 -0500 1377)         av_log(ctx, AV_LOG_ERROR,
848826f527b libavcodec/vp9.c       (Ronald S. Bultje    2013-09-30 23:03:30 -0400 1571)             av_log(ctx, AV_LOG_ERROR, "Failed to allocate frame buffer %d\n", i);
848826f527b libavcodec/vp9.c       (Ronald S. Bultje    2013-09-30 23:03:30 -0400 1580)             av_log(ctx, AV_LOG_ERROR, "Failed to allocate frame buffer %d\n", i);

most of them where added by you.

Why do you complain about me adding an error message to a error case in
code i wrote and maintain while
you add basically identical error messages in code you wrote and
maintain ?

Thanks

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I have often repented speaking, but never of holding my tongue.
-- Xenocrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20170904/9470f388/attachment.sig>


More information about the ffmpeg-devel mailing list