Commit c95857a4 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/ffwavesynth: Check sample rate before use

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/ffmpegReviewed-by: 's avatarNicolas George <george@nsup.org>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 23599834
...@@ -270,7 +270,7 @@ static int wavesynth_parse_extradata(AVCodecContext *avc) ...@@ -270,7 +270,7 @@ static int wavesynth_parse_extradata(AVCodecContext *avc)
dt = in->ts_end - in->ts_start; dt = in->ts_end - in->ts_start;
switch (in->type) { switch (in->type) {
case WS_SINE: case WS_SINE:
if (edata_end - edata < 20) if (edata_end - edata < 20 || avc->sample_rate <= 0)
return AVERROR(EINVAL); return AVERROR(EINVAL);
f1 = AV_RL32(edata + 0); f1 = AV_RL32(edata + 0);
f2 = AV_RL32(edata + 4); f2 = AV_RL32(edata + 4);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment