[FFmpeg-cvslog] avcodec/escape124: Check that blocks are allocated before use

Michael Niedermayer git at videolan.org
Fri Dec 22 01:51:18 EET 2023


ffmpeg | branch: release/4.4 | Michael Niedermayer <michael at niedermayer.cc> | Sun Apr  9 15:18:55 2023 +0200| [74b36995ed33849f9bf2cb8710e15c7e0db2f35e] | committer: Michael Niedermayer

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 at niedermayer.cc>
(cherry picked from commit 5366ae12b9ba60404822f6b39b41f6c0d98a7c8a)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavcodec/escape124.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/escape124.c b/libavcodec/escape124.c
index 58278ecaa7..3d5f2ae79a 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];



More information about the ffmpeg-cvslog mailing list