avformat/mxfdec: Fix file position addition
authorMichael Niedermayer <michael@niedermayer.cc>
Mon, 1 Feb 2021 18:59:55 +0000 (19:59 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 22 Apr 2021 14:22:22 +0000 (16:22 +0200)
Fixes: signed integer overflow: 9223372036854775805 + 4 cannot be represented in type 'long'
Fixes: 29927/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-5579985228267520

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/mxfdec.c

index 1f372affcb8d09feae215d7cf86a4fbe9f39367a..840484b37e0a59ffdb8c7a4308ac35a046b5ab34 100644 (file)
@@ -2903,7 +2903,7 @@ static int mxf_read_local_tags(MXFContext *mxf, KLVPacket *klv, MXFMetadataReadF
         meta = NULL;
         ctx  = mxf;
     }
-    while (avio_tell(pb) + 4 < klv_end && !avio_feof(pb)) {
+    while (avio_tell(pb) + 4ULL < klv_end && !avio_feof(pb)) {
         int ret;
         int tag = avio_rb16(pb);
         int size = avio_rb16(pb); /* KLV specified by 0x53 */