avcodec/takdec: Check remaining space for first predictors

Fixes: Timeout
Fixes: 403673829/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TAK_fuzzer-5498240154009600

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer
2025-05-11 23:09:07 +02:00
parent 4a9d907b5e
commit 8e6db875af

View File

@ -434,6 +434,9 @@ static int decode_subframe(TAKDecContext *s, int32_t *decoded,
return AVERROR_INVALIDDATA;
}
if (get_bits_left(gb) < 2*10 + 2*size)
return AVERROR_INVALIDDATA;
s->predictors[0] = get_sbits(gb, 10);
s->predictors[1] = get_sbits(gb, 10);
s->predictors[2] = get_sbits(gb, size) * (1 << (10 - size));