[FFmpeg-devel] [PATCH 2/3] wavpackenc: report too small buffer
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 819 bytes
Desc: Digital signature
More information about the ffmpeg-devel