aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-01-21 21:41:41 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2021-10-09 22:02:20 +0200
commit95671d383f52908f4bcfcd8c7b4dc1c76ed3f8dc (patch)
tree18d9e2b29c28e952d6f8e35ab19af4f2f2cf458f
parentd558c0cae0ee861e6d86eedca0f27a70b7c929c4 (diff)
downloadffmpeg-95671d383f52908f4bcfcd8c7b4dc1c76ed3f8dc.tar.gz
avformat/mxfdec: Fix integer overflow in next position in mxf_read_local_tags()
Fixes: signed integer overflow: 9223372036854775723 + 8192 cannot be represented in type 'long' Fixes: 29072/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-4812604904177664 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 d3d9b1fc8e2dfc8b4d66c9916ab7221062ff4660) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/mxfdec.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index dd4b02efa1..68e9d21e86 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -2431,8 +2431,11 @@ static int mxf_read_local_tags(MXFContext *mxf, KLVPacket *klv, MXFMetadataReadF
int ret;
int tag = avio_rb16(pb);
int size = avio_rb16(pb); /* KLV specified by 0x53 */
- uint64_t next = avio_tell(pb) + size;
+ int64_t next = avio_tell(pb);
UID uid = {0};
+ if (next < 0 || next > INT64_MAX - size)
+ return next < 0 ? next : AVERROR_INVALIDDATA;
+ next += size;
av_log(mxf->fc, AV_LOG_TRACE, "local tag %#04x size %d\n", tag, size);
if (!size) { /* ignore empty tag, needed for some files with empty UMID tag */