aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2023-04-09 15:18:55 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2023-04-21 01:55:21 +0200
commit7c538b3370f98fc044a028c94204f4b0e55b30f1 (patch)
tree9c3706f7d82453055f71b251efd3cfc0002c03f2
parent271b5016ebfb9833928aa5e00a683a2fd80618ac (diff)
downloadffmpeg-7c538b3370f98fc044a028c94204f4b0e55b30f1.tar.gz
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> (cherry picked from commit 5366ae12b9ba60404822f6b39b41f6c0d98a7c8a) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/escape124.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/escape124.c b/libavcodec/escape124.c
index 50fa882255..5e4e57bf90 100644
--- a/libavcodec/escape124.c
+++ b/libavcodec/escape124.c
@@ -157,7 +157,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];