]> git.sesse.net Git - ffmpeg/commitdiff
avformat/id3v2: Check avio_read() return code in id3v2_parse()
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 15 Dec 2013 14:42:53 +0000 (15:42 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 15 Dec 2013 14:45:44 +0000 (15:45 +0100)
Fixes use of uninitialized memory
Fixes: msan_uninit-mem_7f5a04a9b50d_7087_mp3__mp3__tooSmallFinal.mp3
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/id3v2.c

index 4bc76a321ca5f1adca32e8fc2c02af4ebd6fa379..5f5ccb6322dce6ddd68d1bbbf3b3985516a43e7b 100644 (file)
@@ -667,7 +667,8 @@ static void id3v2_parse(AVFormatContext *s, int len, uint8_t version,
         unsigned long dlen;
 
         if (isv34) {
-            avio_read(s->pb, tag, 4);
+            if (avio_read(s->pb, tag, 4) < 0)
+                break;
             tag[4] = 0;
             if (version == 3) {
                 tlen = avio_rb32(s->pb);
@@ -676,7 +677,8 @@ static void id3v2_parse(AVFormatContext *s, int len, uint8_t version,
             tflags  = avio_rb16(s->pb);
             tunsync = tflags & ID3v2_FLAG_UNSYNCH;
         } else {
-            avio_read(s->pb, tag, 3);
+            if (avio_read(s->pb, tag, 3) < 0)
+                break;
             tag[3] = 0;
             tlen   = avio_rb24(s->pb);
         }