History

avutil/timecode: Avoid fps overflow

Fixes: Integer overflow and division by 0 Fixes: poc-202102-div.mov

Michael Niedermayer committed 5 years ago

Commit c9487541 parent 403b35e1 file · +2 −2Browse files

Unified · Split

libavutil/timecode.c+2−2
@@ -114,8 +114,8 @@ char *av_timecode_make_string(const AVTimecode *tc, char *buf, int framenum) · 113 unmodified lines
114114 }
115115 ff = framenum % fps;
116116 ss = framenum / fps % 60;
117− mm = framenum / (fps*60) % 60;
118− hh = framenum / (fps*3600);
117+ mm = framenum / (fps*60LL) % 60;
118+ hh = framenum / (fps*3600LL);
119119 if (tc->flags & AV_TIMECODE_FLAG_24HOURSMAX)
120120 hh = hh % 24;
121121 snprintf(buf, AV_TIMECODE_STR_SIZE, "%s%02d:%02d:%02d%c%02d",

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t