diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2021-03-01 23:24:37 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2021-10-09 22:02:20 +0200 |
commit | c97f77e4077da73c12e5adc498ebce4b2fae63f2 (patch) | |
tree | 76a14288642758fc3bff33b846d776a8fefe631b | |
parent | ea95ff0a087e0dfbcd27b399adba33595bd2b066 (diff) | |
download | ffmpeg-c97f77e4077da73c12e5adc498ebce4b2fae63f2.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.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c index 9fefe95f1c..6e1e06517f 100644 --- a/libavcodec/alsdec.c +++ b/libavcodec/alsdec.c @@ -1021,6 +1021,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); |