aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2023-09-10 02:37:47 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2023-09-14 22:00:17 +0200
commitca09d8a0dcd82e3128e62463231296aaf63ae6f7 (patch)
treed36e07bcfffe25db7033993d2caaafbeb3cbe4f4
parentd2e8974699a9e35cc1a926bf74a972300d629cd5 (diff)
downloadffmpeg-ca09d8a0dcd82e3128e62463231296aaf63ae6f7.tar.gz
avcodec/jpegxl_parser: Check for ctx->skip overflow
Fixes: out of array access Fixes: 62113/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5025082076168192 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/jpegxl_parser.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/jpegxl_parser.c b/libavcodec/jpegxl_parser.c
index 4010bc713a..6656ed35c5 100644
--- a/libavcodec/jpegxl_parser.c
+++ b/libavcodec/jpegxl_parser.c
@@ -1326,7 +1326,7 @@ static int skip_boxes(JXLParseContext *ctx, const uint8_t *buf, int buf_size)
if (!size)
return AVERROR_INVALIDDATA;
/* invalid ISOBMFF size */
- if (size <= head_size + 4)
+ if (size <= head_size + 4 || size > INT_MAX - ctx->skip)
return AVERROR_INVALIDDATA;
ctx->skip += size;