diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2022-09-17 23:15:56 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2022-10-21 22:19:37 +0200 |
commit | 3c33d80c72edb148654910f383708cb04fbc39b1 (patch) | |
tree | c03b8ade378947c1b9ef9b67d9e0e9c93b071bb1 | |
parent | 13cbb13666dfded4372f5cccc7f9a3dc98a4b28b (diff) | |
download | ffmpeg-3c33d80c72edb148654910f383708cb04fbc39b1.tar.gz |
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>
(cherry picked from commit db73ae0dc114aa6fae08e69f977944f056a24995)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-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 5d64e0a4c5..a17e0f08bb 100644 --- a/libavformat/icodec.c +++ b/libavformat/icodec.c @@ -204,6 +204,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); } |