diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2022-09-18 00:15:56 +0300 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2022-09-22 18:44:05 +0300 |
commit | db73ae0dc114aa6fae08e69f977944f056a24995 (patch) | |
tree | 7f5c92c7be0793fad239f6380404ea991de5c3a7 /libavformat/icodec.c | |
parent | 9303ba272e988d87084880c57056b750cc5ffd08 (diff) |
avformat/icodec: Check nb_pal
Fixes: signed integer overflow: 538976288 * 4 cannot be represented in type 'int'
Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_ICO_fuzzer-6690068904935424
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/icodec.c')
-rw-r--r-- | libavformat/icodec.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libavformat/icodec.c b/libavformat/icodec.c index 290f658d0c..85dab3bca0 100644 --- a/libavformat/icodec.c +++ b/libavformat/icodec.c @@ -196,6 +196,9 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) AV_WL32(buf + 32, image->nb_pal); } + if (image->nb_pal > INT_MAX / 4 - 14 - 40) + return AVERROR_INVALIDDATA; + AV_WL32(buf - 4, 14 + 40 + image->nb_pal * 4); AV_WL32(buf + 8, AV_RL32(buf + 8) / 2); } |