diff options
author | Michael Niedermayer <[email protected]> | 2022-09-17 23:15:56 +0200 |
---|---|---|
committer | Michael Niedermayer <[email protected]> | 2022-09-25 13:51:59 +0200 |
commit | b9b148ef87541b0eb699cb0baa861e262c9e8943 (patch) | |
tree | 73d002c4ef6fbc083346a08d16cc658e22330626 | |
parent | cc5c5beb98996de1a5fe28881f224056cb2aca2e (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 <[email protected]>
Signed-off-by: Michael Niedermayer <[email protected]>
(cherry picked from commit db73ae0dc114aa6fae08e69f977944f056a24995)
Signed-off-by: Michael Niedermayer <[email protected]>
-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 93179bb41e..b321ad6007 100644 --- a/libavformat/icodec.c +++ b/libavformat/icodec.c @@ -203,6 +203,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); } |