]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/decode: Also consider channels in max_samples check
authorMichael Niedermayer <michael@niedermayer.cc>
Fri, 18 Oct 2019 20:24:04 +0000 (22:24 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 9 Nov 2019 15:06:32 +0000 (16:06 +0100)
Fixes: Timeout (109sec -> 0.6sec)
Fixes: 18309/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INTERPLAY_ACM_fuzzer-6226598168100864
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/decode.c

index a7b37c6917d73751d8c9c4ba1638631d6c44b711..0883c7209cdea158a529b29ebd3d4680b0a652c2 100644 (file)
@@ -1925,7 +1925,7 @@ static int get_buffer_internal(AVCodecContext *avctx, AVFrame *frame, int flags)
             return AVERROR(EINVAL);
         }
     } else if (avctx->codec_type == AVMEDIA_TYPE_AUDIO) {
-        if (frame->nb_samples > avctx->max_samples) {
+        if (frame->nb_samples * avctx->channels > avctx->max_samples) {
             av_log(avctx, AV_LOG_ERROR, "samples per frame %d, exceeds max_samples %"PRId64"\n", frame->nb_samples, avctx->max_samples);
             return AVERROR(EINVAL);
         }