aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-03-01 13:44:12 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2021-10-17 21:34:53 +0200
commitf3a82afec92bb76f14a1a974cdb1756c66adc818 (patch)
treef8c9a36efe2dd91bc1488b116aaf0bf280e11c47
parentc09a3b10cd5439163df4d944c9746458a20609b1 (diff)
downloadffmpeg-f3a82afec92bb76f14a1a974cdb1756c66adc818.tar.gz
avutil/timecode: Avoid fps overflow
Fixes: Integer overflow and division by 0 Fixes: poc-202102-div.mov Found-by: 1vanChen of NSFOCUS Security Team Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit c94875471e3ba3dc396c6919ff3ec9b14539cd71) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavutil/timecode.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavutil/timecode.c b/libavutil/timecode.c
index 112f57d4ac..6efd86ab69 100644
--- a/libavutil/timecode.c
+++ b/libavutil/timecode.c
@@ -96,8 +96,8 @@ char *av_timecode_make_string(const AVTimecode *tc, char *buf, int framenum)
}
ff = framenum % fps;
ss = framenum / fps % 60;
- mm = framenum / (fps*60) % 60;
- hh = framenum / (fps*3600);
+ mm = framenum / (fps*60LL) % 60;
+ hh = framenum / (fps*3600LL);
if (tc->flags & AV_TIMECODE_FLAG_24HOURSMAX)
hh = hh % 24;
snprintf(buf, AV_TIMECODE_STR_SIZE, "%s%02d:%02d:%02d%c%02d",