]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/ffwavesynth: Check if there is enough extradata before allocation
authorMichael Niedermayer <michael@niedermayer.cc>
Sun, 14 Jul 2019 22:35:49 +0000 (00:35 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 20 Jul 2019 17:05:02 +0000 (19:05 +0200)
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>
libavcodec/ffwavesynth.c

index 94a843e3cabbdc4933a8b3cb8b0da72be09529d6..b319b3341a6b84c59391258e6d319f7567f4589b 100644 (file)
@@ -247,7 +247,7 @@ static int wavesynth_parse_extradata(AVCodecContext *avc)
     edata_end = edata + avc->extradata_size;
     ws->nb_inter = AV_RL32(edata);
     edata += 4;
-    if (ws->nb_inter < 0)
+    if (ws->nb_inter < 0 || (edata_end - edata) / 24 < ws->nb_inter)
         return AVERROR(EINVAL);
     ws->inter = av_calloc(ws->nb_inter, sizeof(*ws->inter));
     if (!ws->inter)