aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2022-09-17 23:15:56 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2022-09-24 22:48:19 +0200
commit65bc53d6080f997c604083a4cb5fa7d706df2e7a (patch)
tree5196a5e7d963325fc57babb8aafd87e40c69c827 /libavformat
parente628454a43a0801adaada086fdb56d087013d614 (diff)
downloadffmpeg-65bc53d6080f997c604083a4cb5fa7d706df2e7a.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>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/icodec.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavformat/icodec.c b/libavformat/icodec.c
index d86b85099d..23cd91412d 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);
}