]> git.sesse.net Git - ffmpeg/commitdiff
Do not attempt to decode APE file with no frames.
authorKostya Shishkov <kostya.shishkov@gmail.com>
Tue, 15 Mar 2011 19:37:37 +0000 (20:37 +0100)
committerCarl Eugen Hoyos <cehoyos@ag.or.at>
Tue, 15 Mar 2011 19:37:37 +0000 (20:37 +0100)
This fixes invalid reads/writes with this sample:
http://packetstorm.linuxsecurity.com/1103-exploits/vlc105-dos.txt

libavformat/ape.c

index 2de47ef483245372a9a3c56656cd48a30a383856..187c9865a4fce398c7a4b4b19aad0a59b281a469 100644 (file)
@@ -242,6 +242,10 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
             avio_seek(pb, ape->wavheaderlength, SEEK_CUR);
     }
 
+    if(!ape->totalframes){
+        av_log(s, AV_LOG_ERROR, "No frames in the file!\n");
+        return AVERROR(EINVAL);
+    }
     if(ape->totalframes > UINT_MAX / sizeof(APEFrame)){
         av_log(s, AV_LOG_ERROR, "Too many frames: %d\n", ape->totalframes);
         return -1;