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 53d739db4e)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2021-03-01 23:24:37 +01:00
parent 6b0a5c6741
commit db0a8edfe8
1 changed files with 4 additions and 0 deletions

View File

@ -1015,6 +1015,10 @@ static int read_block(ALSDecContext *ctx, ALSBlockData *bd)
ALSSpecificConfig *sconf = &ctx->sconf; ALSSpecificConfig *sconf = &ctx->sconf;
*bd->shift_lsbs = 0; *bd->shift_lsbs = 0;
if (get_bits_left(gb) < 1)
return AVERROR_INVALIDDATA;
// read block type flag and read the samples accordingly // read block type flag and read the samples accordingly
if (get_bits1(gb)) { if (get_bits1(gb)) {
ret = read_var_block_data(ctx, bd); ret = read_var_block_data(ctx, bd);