diff mbox series

[FFmpeg-devel,1/2] avcodec/alsdec: Check bitstream input in read_block()

Message ID 20210302185231.18883-1-michael@niedermayer.cc
State Accepted
Commit 53d739db4e528388fae89459e887a633ffbce12c
Headers show
Series [FFmpeg-devel,1/2] avcodec/alsdec: Check bitstream input in read_block() | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Michael Niedermayer March 2, 2021, 6:52 p.m. UTC
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 | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Michael Niedermayer March 3, 2021, 10:05 a.m. UTC | #1
On Tue, Mar 02, 2021 at 07:52:30PM +0100, Michael Niedermayer wrote:
> 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 | 4 ++++
>  1 file changed, 4 insertions(+)

will apply patchset

[...]
diff mbox series

Patch

diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index b3c444c54f..a8c3433fa8 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -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);