OSDN Git Service

avformat/iff: shrink packets to the initialized data
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 15 Dec 2013 00:32:48 +0000 (01:32 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 15 Dec 2013 00:34:14 +0000 (01:34 +0100)
Fixes use of uninitialized data
Fixes: msan_uninit-mem_7f65b9788da6_388_24.iff
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/iff.c

index edf308b..03c4b08 100644 (file)
@@ -462,6 +462,8 @@ static int iff_read_packet(AVFormatContext *s,
         buf = pkt->data;
         bytestream_put_be16(&buf, 2);
         ret = avio_read(pb, buf, iff->body_size);
+        if (ret>=0 && ret < iff->body_size)
+            av_shrink_packet(pkt, ret + 2);
     } else {
         av_assert0(0);
     }