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

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


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


Comment for this one and the next few:

I believe it is better to know what decoders rely on
FF_INPUT_BUFFER_PADDING_SIZE rather than catch everything in a common test,
but if people prefer the opposite I can drop these cases.


diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index b86168a..6706b07 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -1265,7 +1265,10 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
     *got_frame_ptr   = 1;
     *(AVFrame *)data = c->frame;
 
-    return bytestream2_tell(&gb);
+    ret = bytestream2_tell(&gb);
+    if (ret > avpkt->size && ret <= avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE)
+        ret = avpkt->size; /* small overreads are acceptable */
+    return ret;
 }
 
 
-- 
1.7.10.4



More information about the ffmpeg-devel mailing list