[FFmpeg-devel] [PATCH 2/3] wavpackenc: report too small buffer

Nicolas George george at nsup.org
Tue Aug 19 16:20:24 CEST 2014

Le duodi 2 fructidor, an CCXXII, Christophe Gisquet a écrit :
> >> +        return AVERROR_INVALIDDATA;
> > Shouldn't this be AVERROR_BUG?
> This was selected as a default, not knowing exactly what to put here.
> There's even a AVERROR_BUFFER_TOO_SMALL, but I though it would be used
> for user-provided buffers.

IMHO, the correct error depends on how sure you are that a buffer too small
SHOULD not happen.

If you are very sure, then av_assert0().

If you are moderately sure but a mistake could have bad consequences
(corrupted memory; should not happen here), then av_assert0() too to prevent
the bad consequences from propagating.

If you are moderately sure and a buffer too small is not a severe issue,

If you are not sure at all, then av_realloc().

As you pointed, BUFFER_TOO_SMALL is when you do not choose the size of the


  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140819/30a55aca/attachment.asc>

More information about the ffmpeg-devel mailing list