ape: Fix null ptr dereference with files missing a seekatable.
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 29 May 2012 17:50:15 +0000 (19:50 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 9 Jun 2012 18:40:50 +0000 (20:40 +0200)
Such files are currently not supported as the table is used at several points

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit e7cb161515fc9fb6d30d1681d64d9ba7ad737a4e)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/ape.c

index 72fca5d..016638b 100644 (file)
@@ -278,6 +278,9 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
             return AVERROR(ENOMEM);
         for (i = 0; i < ape->seektablelength / sizeof(uint32_t); i++)
             ape->seektable[i] = avio_rl32(pb);
+    }else{
+        av_log(s, AV_LOG_ERROR, "Missing seektable\n");
+        return -1;
     }
 
     ape->frames[0].pos     = ape->firstframe;