[FFmpeg-devel,2/4] avcodec/decode: Also consider channels in max_samples check

Submitted by Michael Niedermayer on Oct. 18, 2019, 10:19 p.m.

Details

Message ID 20191018221924.677-2-michael@niedermayer.cc
State Accepted
Commit 20fad712474f582e74df025365a4b4860b779592
Headers show

Commit Message

Michael Niedermayer Oct. 18, 2019, 10:19 p.m.
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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Niedermayer Nov. 9, 2019, 3:09 p.m.
On Sat, Oct 19, 2019 at 12:19:22AM +0200, Michael Niedermayer wrote:
> 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 | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

[...]

Patch hide | download patch | download mbox

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index a7b37c6917..0883c7209c 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -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);
         }