aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-12-12 01:24:42 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2021-09-09 13:53:29 +0200
commit0fb1a9f6ecfc753824b707a4c251b5abe37acd0e (patch)
tree83d79ed3d66b8d04c6061ad3bcacea504c6ecdaf
parent1506eb092b45245a0bab1b7be0d856649dc38dff (diff)
downloadffmpeg-0fb1a9f6ecfc753824b707a4c251b5abe37acd0e.tar.gz
avformat/voc_packet: Add a basic check on max_size
Fixes: signed integer overflow: -2147483648 - 4 cannot be represented in type 'int' Fixes: 28127/clusterfuzz-testcase-minimized-ffmpeg_dem_VOC_fuzzer-4880586455646208 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 52f75181bfada2b4b127e744674591c7753c4b7d) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/voc_packet.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavformat/voc_packet.c b/libavformat/voc_packet.c
index 1e2e19e1c3..9d7d2025cd 100644
--- a/libavformat/voc_packet.c
+++ b/libavformat/voc_packet.c
@@ -44,6 +44,8 @@ ff_voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size)
AVINDEX_KEYFRAME);
while (!voc->remaining_size) {
+ if (max_size < 4)
+ max_size = 0;
type = avio_r8(pb);
if (type == VOC_TYPE_EOF)
return AVERROR_EOF;