avutil/timecode: Avoid undefined behavior with large framenum

Fixes: signed integer overflow: 2147462079 + 2149596 cannot be represented in type 'int'
Fixes: 27565/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5091972813160448

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 2020-11-28 21:31:16 +01:00
parent 8c9a5a0fe9
commit 1b19057396
1 changed files with 1 additions and 1 deletions

View File

@ -46,7 +46,7 @@ int av_timecode_adjust_ntsc_framenum2(int framenum, int fps)
d = framenum / frames_per_10mins; d = framenum / frames_per_10mins;
m = framenum % frames_per_10mins; m = framenum % frames_per_10mins;
return framenum + 9 * drop_frames * d + drop_frames * ((m - drop_frames) / (frames_per_10mins / 10)); return framenum + 9U * drop_frames * d + drop_frames * ((m - drop_frames) / (frames_per_10mins / 10));
} }
uint32_t av_timecode_get_smpte_from_framenum(const AVTimecode *tc, int framenum) uint32_t av_timecode_get_smpte_from_framenum(const AVTimecode *tc, int framenum)