]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/wmavoice: Check sample_rate
authorMichael Niedermayer <michael@niedermayer.cc>
Wed, 23 Oct 2019 20:32:47 +0000 (22:32 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 9 Nov 2019 16:27:20 +0000 (17:27 +0100)
Fixes: left shift of 538976288 by 8 places cannot be represented in type 'int'
Fixes: 18376/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMAVOICE_fuzzer-5741645391200256
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/wmavoice.c

index 68bb65986e38d0773c55c2e617f5937db43c6c82..4c147fe04fcb9908593b19925d251105c059ff57 100644 (file)
@@ -433,6 +433,9 @@ static av_cold int wmavoice_decode_init(AVCodecContext *ctx)
         return AVERROR_INVALIDDATA;
     }
 
+    if (ctx->sample_rate >= INT_MAX / (256 * 37))
+        return AVERROR_INVALIDDATA;
+
     s->min_pitch_val    = ((ctx->sample_rate << 8)      /  400 + 50) >> 8;
     s->max_pitch_val    = ((ctx->sample_rate << 8) * 37 / 2000 + 50) >> 8;
     pitch_range         = s->max_pitch_val - s->min_pitch_val;