]> git.sesse.net Git - ffmpeg/commitdiff
avformat/mccdec: Use av_sat_add64() for fs
authorMichael Niedermayer <michael@niedermayer.cc>
Thu, 14 Jan 2021 21:15:18 +0000 (22:15 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Wed, 3 Mar 2021 15:54:20 +0000 (16:54 +0100)
Fixes: signed integer overflow: -9223372036854775808 + -242 cannot be represented in type 'long'
Fixes: 26910/clusterfuzz-testcase-minimized-ffmpeg_dem_MCC_fuzzer-6723018395090944
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/mccdec.c

index 874ff45cdf3e9513da511094da702b3da6cbf728..2a0b7905a012dfbf9d41c9a905f0efb44df7014e 100644 (file)
@@ -142,7 +142,7 @@ static int mcc_read_header(AVFormatContext *s)
         if (av_sscanf(line, "%d:%d:%d:%d", &hh, &mm, &ss, &fs) != 4)
             continue;
 
-        ts = av_rescale(hh * 3600LL + mm * 60LL + ss, rate.num, rate.den) + fs;
+        ts = av_sat_add64(av_rescale(hh * 3600LL + mm * 60LL + ss, rate.num, rate.den), fs);
 
         lline = (char *)&line;
         lline += 12;