[FFmpeg-cvslog] avformat/adxdec: dont return random data on EOF

Michael Niedermayer git at videolan.org
Tue Jan 7 18:33:55 CET 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Jan  7 16:05:56 2014 +0100| [8aead3ffa89a7d92b54b049a63bf6485f643835b] | committer: Michael Niedermayer

avformat/adxdec: dont return random data on EOF

Fixes use of uninitialized memory
Partly fixes; msan_uninit-mem_7fb7d24780d0_2744_R03T.CAK
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8aead3ffa89a7d92b54b049a63bf6485f643835b
---

 libavcodec/adxdec.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/adxdec.c b/libavcodec/adxdec.c
index e59cc92..ec33e73 100644
--- a/libavcodec/adxdec.c
+++ b/libavcodec/adxdec.c
@@ -157,9 +157,11 @@ static int adx_decode_frame(AVCodecContext *avctx, void *data,
             buf_size -= BLOCK_SIZE;
             buf      += BLOCK_SIZE;
         }
-        samples_offset += BLOCK_SAMPLES;
+        if (!c->eof)
+            samples_offset += BLOCK_SAMPLES;
     }
 
+    frame->nb_samples = samples_offset;
     *got_frame_ptr = 1;
 
     return buf - avpkt->data;



More information about the ffmpeg-cvslog mailing list