avformat/mccdec: Use av_sat_add64() for fs

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>
This commit is contained in:
Michael Niedermayer 2021-01-14 22:15:18 +01:00
parent 5d7f17e885
commit 6c5121379a

View 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) if (av_sscanf(line, "%d:%d:%d:%d", &hh, &mm, &ss, &fs) != 4)
continue; 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 = (char *)&line;
lline += 12; lline += 12;