Browse Source

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>
tags/n4.4
Michael Niedermayer 4 years ago
parent
commit
c94875471e
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      libavutil/timecode.c

+ 2
- 2
libavutil/timecode.c View File

@@ -114,8 +114,8 @@ char *av_timecode_make_string(const AVTimecode *tc, char *buf, int framenum)
} }
ff = framenum % fps; ff = framenum % fps;
ss = framenum / fps % 60; 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) if (tc->flags & AV_TIMECODE_FLAG_24HOURSMAX)
hh = hh % 24; hh = hh % 24;
snprintf(buf, AV_TIMECODE_STR_SIZE, "%s%02d:%02d:%02d%c%02d", snprintf(buf, AV_TIMECODE_STR_SIZE, "%s%02d:%02d:%02d%c%02d",


Loading…
Cancel
Save