Browse Source

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/ffmpeg
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 65bac4a782)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
tags/n3.4.7
Michael Niedermayer 6 years ago
parent
commit
2d86e41d45
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      libavcodec/ffwavesynth.c

+ 1
- 1
libavcodec/ffwavesynth.c View File

@@ -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)


Loading…
Cancel
Save