Commit 65bac4a7 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/ffwavesynth: Check if there is enough extradata before allocation

Fixes: OOM
Fixes: 15750/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFWAVESYNTH_fuzzer-5702090367696896

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 f4605770
...@@ -247,7 +247,7 @@ static int wavesynth_parse_extradata(AVCodecContext *avc) ...@@ -247,7 +247,7 @@ static int wavesynth_parse_extradata(AVCodecContext *avc)
edata_end = edata + avc->extradata_size; edata_end = edata + avc->extradata_size;
ws->nb_inter = AV_RL32(edata); ws->nb_inter = AV_RL32(edata);
edata += 4; edata += 4;
if (ws->nb_inter < 0) if (ws->nb_inter < 0 || (edata_end - edata) / 24 < ws->nb_inter)
return AVERROR(EINVAL); return AVERROR(EINVAL);
ws->inter = av_calloc(ws->nb_inter, sizeof(*ws->inter)); ws->inter = av_calloc(ws->nb_inter, sizeof(*ws->inter));
if (!ws->inter) if (!ws->inter)
......
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