Commit 20fad712 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/decode: Also consider channels in max_samples check

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/ffmpegSigned-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 17603094
...@@ -1925,7 +1925,7 @@ static int get_buffer_internal(AVCodecContext *avctx, AVFrame *frame, int flags) ...@@ -1925,7 +1925,7 @@ static int get_buffer_internal(AVCodecContext *avctx, AVFrame *frame, int flags)
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }
} else if (avctx->codec_type == AVMEDIA_TYPE_AUDIO) { } 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); av_log(avctx, AV_LOG_ERROR, "samples per frame %d, exceeds max_samples %"PRId64"\n", frame->nb_samples, avctx->max_samples);
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }
......
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