[FFmpeg-cvslog] avcodec/alsdec: Check bits left before block decoding in non multi channel coding loop

Michael Niedermayer git at videolan.org
Thu Feb 23 23:20:12 EET 2023


ffmpeg | branch: release/5.1 | Michael Niedermayer <michael at niedermayer.cc> | Sat Oct 29 18:47:34 2022 +0200| [e475ea86f2bdc8f2e5e9a6dc14216768292ab41d] | committer: Michael Niedermayer

avcodec/alsdec: Check bits left before block decoding in non multi channel coding loop

Fixes: Timeout
Fixes: 52161/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-6440216563154944

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
(cherry picked from commit 1dc8d82da910972d308aebc1ee722044f83b9ccc)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e475ea86f2bdc8f2e5e9a6dc14216768292ab41d
---

 libavcodec/alsdec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index b87cb12567..2cafce8cb3 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -1659,7 +1659,8 @@ static int read_frame_data(ALSDecContext *ctx, unsigned int ra_frame)
 
     if (!sconf->mc_coding || ctx->js_switch) {
         int independent_bs = !sconf->joint_stereo;
-
+        if (get_bits_left(gb) < 7*channels*ctx->num_blocks)
+            return AVERROR_INVALIDDATA;
         for (c = 0; c < channels; c++) {
             js_blocks[0] = 0;
             js_blocks[1] = 0;



More information about the ffmpeg-cvslog mailing list