[FFmpeg-devel] [PATCH 4/4] avformat/mxfdec: Check edit_unit for being larger than signed 64bit

Michael Niedermayer michael at niedermayer.cc
Sun Dec 1 06:03:06 EET 2024


Fixes: signed integer overflow: 2 * -4962931467012268000 cannot be represented in type 'long'
Fixes: 376496313/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-4921469185884160

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavformat/mxfdec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 9ecaa287bb4..958a8548e84 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -1924,6 +1924,8 @@ static int mxf_edit_unit_absolute_offset(MXFContext *mxf, MXFIndexTable *index_t
     // clamp to actual range of index
     index_end = av_sat_add64(last_segment->index_start_position, last_segment->index_duration);
     edit_unit = FFMAX(FFMIN(edit_unit, index_end), first_segment->index_start_position);
+    if (edit_unit < 0)
+        return AVERROR_PATCHWELCOME;
 
     // guess which table segment this edit unit is in
     // saturation is fine since it's just a guess
-- 
2.47.0



More information about the ffmpeg-devel mailing list