vqf: check samplerate, avoid division by 0.
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 9 Nov 2012 17:04:54 +0000 (18:04 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 9 Nov 2012 17:05:19 +0000 (18:05 +0100)
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/vqf.c

index 5fff84e..f1e6aaf 100644 (file)
@@ -175,6 +175,10 @@ static int vqf_read_header(AVFormatContext *s)
         break;
     default:
         st->codec->sample_rate = rate_flag*1000;
+        if (st->codec->sample_rate <= 0) {
+            av_log(s, AV_LOG_ERROR, "sample rate %d is invalid\n", st->codec->sample_rate);
+            return -1;
+        }
         break;
     }