]> git.sesse.net Git - ffmpeg/commitdiff
avformat/vqf: check number of channels before use.
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 7 May 2013 20:26:22 +0000 (22:26 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 7 May 2013 20:26:56 +0000 (22:26 +0200)
Fixes division by zero

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/vqf.c

index ed588288b87429722ec6b9d4c76fc5925e8d351c..1ce53595d606b379b2c1ee671bb4b7aae4f734df 100644 (file)
@@ -132,6 +132,11 @@ static int vqf_read_header(AVFormatContext *s)
             rate_flag           = AV_RB32(comm_chunk + 8);
             avio_skip(s->pb, len-12);
 
+            if (st->codec->channels <= 0) {
+                av_log(s, AV_LOG_ERROR, "Invalid number of channels\n");
+                return AVERROR_INVALIDDATA;
+            }
+
             st->codec->bit_rate              = read_bitrate*1000;
             break;
         case MKTAG('D','S','I','Z'): // size of compressed data