[FFmpeg-cvslog] avformat/jacosubdec: Fix timeres to 1/100 units convertion overflow
Michael Niedermayer
git at videolan.org
Fri Jun 21 19:29:41 EEST 2019
ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Fri Jun 7 22:43:42 2019 +0200| [06a90cc78385d87b346be23efc9081eb08936c18] | committer: Michael Niedermayer
avformat/jacosubdec: Fix timeres to 1/100 units convertion overflow
Fixes: signed integer overflow: 44444442 * 100 cannot be represented in type 'int'
Fixes: 15117/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5164660531134464
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=06a90cc78385d87b346be23efc9081eb08936c18
---
libavformat/jacosubdec.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/libavformat/jacosubdec.c b/libavformat/jacosubdec.c
index 50144f7e21..121c86d659 100644
--- a/libavformat/jacosubdec.c
+++ b/libavformat/jacosubdec.c
@@ -107,6 +107,7 @@ static const char *read_ts(JACOsubContext *jacosub, const char *buf,
unsigned hs, ms, ss, fs; // hours, minutes, seconds, frame start
unsigned he, me, se, fe; // hours, minutes, seconds, frame end
int ts_start, ts_end;
+ int64_t ts_start64, ts_end64;
/* timed format */
if (sscanf(buf, "%u:%u:%u.%u %u:%u:%u.%u %n",
@@ -124,10 +125,10 @@ static const char *read_ts(JACOsubContext *jacosub, const char *buf,
return NULL;
shift_and_ret:
- ts_start = (ts_start + jacosub->shift) * 100 / jacosub->timeres;
- ts_end = (ts_end + jacosub->shift) * 100 / jacosub->timeres;
- *start = ts_start;
- *duration = ts_end - ts_start;
+ ts_start64 = (ts_start + jacosub->shift) * 100LL / jacosub->timeres;
+ ts_end64 = (ts_end + jacosub->shift) * 100LL / jacosub->timeres;
+ *start = ts_start64;
+ *duration = ts_end64 - ts_start64;
return buf + len;
}
More information about the ffmpeg-cvslog
mailing list