[FFmpeg-devel] [PATCH 3/5] avformat/mxfdec: Fix overflow in midpoint computation

Michael Niedermayer michael at niedermayer.cc
Thu Oct 10 03:18:30 EEST 2024


Fixes: signed integer overflow: 4611686016549392399 + 9223372033098784800 cannot be represented in type 'long long'
Fixes: 368503277/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-5928227458056192

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, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index e5f59089ab4..147b6a17f68 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -3894,7 +3894,7 @@ static int mxf_get_next_track_edit_unit(MXFContext *mxf, MXFTrack *track, int64_
     a = -1;
     b = track->original_duration;
     while (b - 1 > a) {
-        m = (a + b) >> 1;
+        m = (a + (uint64_t)b) >> 1;
         if (mxf_edit_unit_absolute_offset(mxf, t, m, track->edit_rate, NULL, &offset, NULL, 0) < 0)
             return -1;
         if (offset < current_offset)
-- 
2.47.0



More information about the ffmpeg-devel mailing list