diff mbox series

[FFmpeg-devel,2/3] avcodec/4xm: Check for cfrm exhaustion

Message ID 20231108021244.8669-2-michael@niedermayer.cc
State Accepted
Commit bb0a684d93f793457f7bff3940a1398eb9e91703
Headers show
Series [FFmpeg-devel,1/3] avformat/mov: Disallow FTYP after streams | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Michael Niedermayer Nov. 8, 2023, 2:12 a.m. UTC
Fixes: index -1 out of bounds for type 'CFrameBuffer [100]'
Fixes: 63877/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FOURXM_fuzzer-5854263397711872

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/4xm.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Michael Niedermayer Nov. 9, 2023, 11:13 p.m. UTC | #1
On Wed, Nov 08, 2023 at 03:12:43AM +0100, Michael Niedermayer wrote:
> Fixes: index -1 out of bounds for type 'CFrameBuffer [100]'
> Fixes: 63877/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FOURXM_fuzzer-5854263397711872
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/4xm.c | 2 ++
>  1 file changed, 2 insertions(+)

will apply the 4xm and mov patches so they are in the upcoming releases

thx

[...]
diff mbox series

Patch

diff --git a/libavcodec/4xm.c b/libavcodec/4xm.c
index 158b37a38bc..cfe65c178a4 100644
--- a/libavcodec/4xm.c
+++ b/libavcodec/4xm.c
@@ -885,6 +885,8 @@  static int decode_frame(AVCodecContext *avctx, AVFrame *picture,
         }
 
         if (i >= CFRAME_BUFFER_COUNT) {
+            if (free_index < 0)
+                return AVERROR_INVALIDDATA;
             i             = free_index;
             f->cfrm[i].id = id;
         }