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
This commit is contained in:
Michael Niedermayer 2022-10-29 18:47:34 +02:00
parent 5280947fb6
commit 1dc8d82da9
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64

View File

@ -1660,7 +1660,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;