[FFmpeg-devel] [PATCH 3/3] avformat/sbgdec: Fixes integer overflow in str_to_time() with hours

Michael Niedermayer michael at niedermayer.cc
Fri Jun 7 00:50:59 EEST 2019


Fixes: signed integer overflow: 904444 * 3600 cannot be represented in type 'int'
Fixes: 15113/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5764083346833408

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/sbgdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/sbgdec.c b/libavformat/sbgdec.c
index 67ae39698e..4155395da0 100644
--- a/libavformat/sbgdec.c
+++ b/libavformat/sbgdec.c
@@ -197,7 +197,7 @@ static int str_to_time(const char *str, int64_t *rtime)
         if (end > cur + 1)
             cur = end;
     }
-    *rtime = (hours * 3600 + minutes * 60 + seconds) * AV_TIME_BASE;
+    *rtime = (hours * 3600LL + minutes * 60LL + seconds) * AV_TIME_BASE;
     return cur - str;
 }
 
-- 
2.21.0



More information about the ffmpeg-devel mailing list