]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/ffwavesynth: Check sample rate before use
authorMichael Niedermayer <michael@niedermayer.cc>
Sun, 14 Jul 2019 22:35:47 +0000 (00:35 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 20 Jul 2019 17:05:02 +0000 (19:05 +0200)
Fixes: division by zero
Fixes: 15725/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFWAVESYNTH_fuzzer-5641231956180992
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/ffwavesynth.c

index 793eada7a58ff7b74f74049cacb97ce06dfdbd94..1dbfaa58473916ea5062fde490541e784bf2e8a0 100644 (file)
@@ -270,7 +270,7 @@ static int wavesynth_parse_extradata(AVCodecContext *avc)
         dt = in->ts_end - in->ts_start;
         switch (in->type) {
             case WS_SINE:
-                if (edata_end - edata < 20)
+                if (edata_end - edata < 20 || avc->sample_rate <= 0)
                     return AVERROR(EINVAL);
                 f1  = AV_RL32(edata +  0);
                 f2  = AV_RL32(edata +  4);