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,
AVERROR_BUG.

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
buffer.

Regards,

-- 
  Nicolas George

Attachment: signature.asc
Description: Digital signature

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to