diff mbox series

[FFmpeg-devel,2/3] avformat/jpegxl_anim_dec: Check that size fits within argument

Message ID 20230910010952.24389-2-michael@niedermayer.cc
State Accepted
Commit d2e8974699a9e35cc1a926bf74a972300d629cd5
Headers show
Series [FFmpeg-devel,1/3] avcodec/wavarc: Use unsigned for samples in 1dif, 2slp, 5elp | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Michael Niedermayer Sept. 10, 2023, 1:09 a.m. UTC
Fixes: out of array access
Fixes: 61991/clusterfuzz-testcase-minimized-ffmpeg_dem_JPEGXL_ANIM_fuzzer-5524679648215040

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

Comments

Michael Niedermayer Sept. 14, 2023, 7:47 p.m. UTC | #1
On Sun, Sep 10, 2023 at 03:09:51AM +0200, Michael Niedermayer wrote:
> Fixes: out of array access
> Fixes: 61991/clusterfuzz-testcase-minimized-ffmpeg_dem_JPEGXL_ANIM_fuzzer-5524679648215040
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/jpegxl_anim_dec.c | 2 ++
>  1 file changed, 2 insertions(+)

will apply the 2 jpegxl patches as 2 more reports about the same issue appeared

[...]
diff mbox series

Patch

diff --git a/libavformat/jpegxl_anim_dec.c b/libavformat/jpegxl_anim_dec.c
index fc95a1781f6..54cd6e4e9d6 100644
--- a/libavformat/jpegxl_anim_dec.c
+++ b/libavformat/jpegxl_anim_dec.c
@@ -152,6 +152,8 @@  static int jpegxl_anim_read_packet(AVFormatContext *s, AVPacket *pkt)
     size = avio_size(pb);
     if (size < 0)
         return size;
+    if (size > INT_MAX)
+        return AVERROR(EDOM);
     if (size == 0)
         size = 4096;