1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00

avcodec/escape124: Check that blocks are allocated before use

Fixes: NULL pointer dereference
Fixes: 57819/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ESCAPE124_fuzzer-5077280228769792

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 2023-04-09 15:18:55 +02:00
parent 0ecda4fbce
commit 5366ae12b9
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64

View File

@ -155,7 +155,7 @@ static MacroBlock decode_macroblock(Escape124Context* s, GetBitContext* gb,
// This condition can occur with invalid bitstreams and
// *codebook_index == 2
if (block_index >= s->codebooks[*codebook_index].size)
if (block_index >= s->codebooks[*codebook_index].size || !s->codebooks[*codebook_index].blocks)
return (MacroBlock) { { 0 } };
return s->codebooks[*codebook_index].blocks[block_index];