]> git.sesse.net Git - ffmpeg/commitdiff
avformat/realtextdec: Avoid undefined overflow in the end of read_ts()
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 16 Jan 2021 22:37:41 +0000 (23:37 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Tue, 26 Jan 2021 17:37:12 +0000 (18:37 +0100)
Fixes: signed integer overflow: 234080282628234040 * 100 cannot be represented in type 'long long'
Fixes: 26910/clusterfuzz-testcase-minimized-ffmpeg_dem_REALTEXT_fuzzer-6649867065753600
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/realtextdec.c

index 390f8ddc679f6c4ef89a87fabc326e41744247da..f534774420a0970a459b7a9d119e6e7541144ef1 100644 (file)
@@ -54,7 +54,7 @@ static int64_t read_ts(const char *s)
     if (sscanf(s,    "%u:%u.%u",      &mm, &ss, &ms) == 3) return (            mm*60LL + ss) * 100LL + ms;
     if (sscanf(s,    "%u:%u"   ,      &mm, &ss     ) == 2) return (            mm*60LL + ss) * 100LL;
     if (sscanf(s,       "%u.%u",           &ss, &ms) == 2) return (                      ss) * 100LL + ms;
-    return strtol(s, NULL, 10) * 100LL;
+    return strtoll(s, NULL, 10) * 100ULL;
 }
 
 static int realtext_read_header(AVFormatContext *s)