aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-03-01 23:24:37 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2021-09-10 16:04:26 +0200
commitdb0a8edfe8ff5f6640a3edce36a860259b2d38e3 (patch)
tree62381c057ef268e8382fc37dc37678b966f3d756
parent6b0a5c67417f8a428c39d568622c2447e748cd00 (diff)
downloadffmpeg-db0a8edfe8ff5f6640a3edce36a860259b2d38e3.tar.gz
avcodec/alsdec: Check bitstream input in read_block()
Fixes: Timeout Fixes: 28110/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-5036338973507584 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 53d739db4e528388fae89459e887a633ffbce12c) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/alsdec.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index 0fd7278ad8..6f3311356d 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -1015,6 +1015,10 @@ static int read_block(ALSDecContext *ctx, ALSBlockData *bd)
ALSSpecificConfig *sconf = &ctx->sconf;
*bd->shift_lsbs = 0;
+
+ if (get_bits_left(gb) < 1)
+ return AVERROR_INVALIDDATA;
+
// read block type flag and read the samples accordingly
if (get_bits1(gb)) {
ret = read_var_block_data(ctx, bd);