aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-02-11 22:58:53 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2021-09-09 13:53:29 +0200
commita8cfab28cbe59df847749fb6ee8a4bc096ff6bbe (patch)
tree6e8a1a5defe685318d66c93cc5c6785b5e2cff58
parent322a0a6dd2a2a5f3df10b8b2453ee0494d03741a (diff)
downloadffmpeg-a8cfab28cbe59df847749fb6ee8a4bc096ff6bbe.tar.gz
avformat/flvdec: Check array entry number
Fixes: signed integer overflow: -2147483648 - 1 cannot be represented in type 'int' Fixes: 30209/clusterfuzz-testcase-minimized-ffmpeg_dem_FLV_fuzzer-5724831658147840 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 b5d8fe1c874947ca67ee8117b18f8052f0e590fc) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/flvdec.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index d2d9b5bd43..a2fa275b7e 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -835,6 +835,8 @@ static int amf_skip_tag(AVIOContext *pb, AMFDataType type, int depth)
parse_name = 0;
case AMF_DATA_TYPE_MIXEDARRAY:
nb = avio_rb32(pb);
+ if (nb < 0)
+ return AVERROR_INVALIDDATA;
case AMF_DATA_TYPE_OBJECT:
while(!pb->eof_reached && (nb-- > 0 || type != AMF_DATA_TYPE_ARRAY)) {
if (parse_name) {