From ad22767cb61cdc75541b21154d65fd1ad6351025 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 22 May 2013 17:39:22 +0200 Subject: [PATCH] shorten: fix "off by padding" bug Fixes array overread Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer --- libavcodec/shorten.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c index 23c5d7cf9b..3bba10c398 100644 --- a/libavcodec/shorten.c +++ b/libavcodec/shorten.c @@ -437,7 +437,7 @@ static int shorten_decode_frame(AVCodecContext *avctx, void *data, buf_size = FFMIN(buf_size, s->max_framesize - s->bitstream_size); input_buf_size = buf_size; - if (s->bitstream_index + s->bitstream_size + buf_size > + if (s->bitstream_index + s->bitstream_size + buf_size + FF_INPUT_BUFFER_PADDING_SIZE > s->allocated_bitstream_size) { memmove(s->bitstream, &s->bitstream[s->bitstream_index], s->bitstream_size);