oggparsespeex: validate sample_rate
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Sun, 23 Oct 2016 15:12:49 +0000 (17:12 +0200)
committerAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Sun, 6 Nov 2016 23:51:49 +0000 (00:51 +0100)
A negative sample rate doesn't make sense and triggers assertions in
av_rescale_rnd.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
libavformat/oggparsespeex.c

index 434b0fd..2b49150 100644 (file)
@@ -68,6 +68,10 @@ static int speex_header(AVFormatContext *s, int idx) {
         }
 
         st->codecpar->sample_rate = AV_RL32(p + 36);
+        if (st->codecpar->sample_rate <= 0) {
+            av_log(s, AV_LOG_ERROR, "Invalid sample rate %d\n", st->codecpar->sample_rate);
+            return AVERROR_INVALIDDATA;
+        }
         st->codecpar->channels = AV_RL32(p + 48);
         if (st->codecpar->channels < 1 || st->codecpar->channels > 2) {
             av_log(s, AV_LOG_ERROR, "invalid channel count. Speex must be mono or stereo.\n");