[PATCH] libavformat/mov: limit nb_frames_for_fps to INT_MAX

Dan Sanders sandersd at google.com
Sat Apr 20 00:52:01 EEST 2019


Fixes: UBSan runtime error
Found-by: Clusterfuzz
---
 libavformat/mov.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index d5ce077e63..7e7de5962d 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2940,7 +2940,7 @@ static int mov_read_stts(MOVContext *c,
AVIOContext *pb, MOVAtom atom)

     if (duration > 0 &&
         duration <= INT64_MAX - sc->duration_for_fps &&
-        total_sample_count <= INT64_MAX - sc->nb_frames_for_fps
+        total_sample_count <= INT_MAX - sc->nb_frames_for_fps
     ) {
         sc->duration_for_fps  += duration;
         sc->nb_frames_for_fps += total_sample_count;
-- 
2.21.0.593.g511ec345e18-goog


More information about the ffmpeg-devel mailing list