[FFmpeg-devel] [PATCH 04/19] snowdec: fix return value for small overreads.

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sun Jul 29 17:34:30 CEST 2012


On Sun, Jul 29, 2012 at 03:57:22PM +0200, Nicolas George wrote:
> 
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
>  libavcodec/snowdec.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/libavcodec/snowdec.c b/libavcodec/snowdec.c
> index f3d4656..7ebe7d9 100644
> --- a/libavcodec/snowdec.c
> +++ b/libavcodec/snowdec.c
> @@ -557,6 +557,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
>  
>      bytes_read= c->bytestream - c->bytestream_start;
>      if(bytes_read ==0) av_log(s->avctx, AV_LOG_ERROR, "error at end of frame\n"); //FIXME
> +    if (bytes_read > avpkt->size && bytes_read <= avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE)
> +        bytes_read = avpkt->size; /* small overreads are acceptable */
>  
>      return bytes_read;
>  }

Maybe we should just handle that in the wrapper function?
And also e.g. assert that the overread never is too large?


More information about the ffmpeg-devel mailing list