[FFmpeg-cvslog] avformat/nutdec: fix packet end clearing

Michael Niedermayer git at videolan.org
Fri Jan 10 01:10:56 CET 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri Jan 10 00:32:39 2014 +0100| [7f9697aa114c9c452272351de759a6291e782da9] | committer: Michael Niedermayer

avformat/nutdec: fix packet end clearing

The code was buggy, using the wrong variable, also it missed the case
where the packet become smaller due to sidedata/metadata being extracted
which left a few bytes uninitialized

Fixes use of uninitialized memory
Fixed: msan_uninit-mem_7f6abbe44530_6838_mewmew_vorbis_ssa.nut
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=7f9697aa114c9c452272351de759a6291e782da9
---

 libavformat/nutdec.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index 250e13f..5746416 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -1011,8 +1011,8 @@ static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code)
     if (ret != size) {
         if (ret < 0)
             return ret;
-        av_shrink_packet(pkt, nut->header_len[header_idx] + size);
     }
+    av_shrink_packet(pkt, nut->header_len[header_idx] + ret);
 
     pkt->stream_index = stream_id;
     if (stc->last_flags & FLAG_KEY)



More information about the ffmpeg-cvslog mailing list