]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/alsdec: Check bitstream input in read_block()
authorMichael Niedermayer <michael@niedermayer.cc>
Mon, 1 Mar 2021 22:24:37 +0000 (23:24 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Wed, 3 Mar 2021 10:40:40 +0000 (11:40 +0100)
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>
libavcodec/alsdec.c

index b3c444c54f4a601d48724626c0a1f4d789fe561f..a8c3433fa869668faec0e903c3de10479b8cb58b 100644 (file)
@@ -1016,6 +1016,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);