From 09e942aa4d597a75a3c510bf96583302ae707f30 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 4 Oct 2019 19:35:15 +0200 Subject: [PATCH] avcodec/alsdec: Check that input space for header exists in read_diff_float_data() Fixes: Timeout (21sec -> 8sec) Fixes: 17832/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-5737092172218368 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 09581f7923ed9af7719762868e8f1ff626ea8374) Signed-off-by: Michael Niedermayer --- libavcodec/alsdec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c index 223f3f94f5..a9740699f6 100644 --- a/libavcodec/alsdec.c +++ b/libavcodec/alsdec.c @@ -1480,6 +1480,9 @@ static int read_diff_float_data(ALSDecContext *ctx, unsigned int ra_frame) { ff_mlz_flush_dict(ctx->mlz); } + if (avctx->channels * 8 > get_bits_left(gb)) + return AVERROR_INVALIDDATA; + for (c = 0; c < avctx->channels; ++c) { if (use_acf) { //acf_flag