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

Nicolas George nicolas.george at normalesup.org
Sun Jul 29 15:57:23 CEST 2012


Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
---
 libavcodec/mpc8.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/mpc8.c b/libavcodec/mpc8.c
index d9594ec..2161aac 100644
--- a/libavcodec/mpc8.c
+++ b/libavcodec/mpc8.c
@@ -425,7 +425,10 @@ static int mpc8_decode_frame(AVCodecContext * avctx, void *data,
     *got_frame_ptr   = 1;
     *(AVFrame *)data = c->frame;
 
-    return c->cur_frame ? c->last_bits_used >> 3 : buf_size;
+    res = c->cur_frame ? c->last_bits_used >> 3 : buf_size;
+    if (res > avpkt->size && res <= avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE)
+        res = avpkt->size; /* small overreads are acceptable */
+    return res;
 }
 
 AVCodec ff_mpc8_decoder = {
-- 
1.7.10.4



More information about the ffmpeg-devel mailing list