OSDN Git Service

lavf/webvttdec: fix potential timing overflows.
authorClément Bœsch <ubitux@gmail.com>
Sat, 20 Oct 2012 23:16:49 +0000 (01:16 +0200)
committerClément Bœsch <ubitux@gmail.com>
Sat, 20 Oct 2012 23:16:49 +0000 (01:16 +0200)
Should fix CID733781 and CID733782.

libavformat/webvttdec.c

index b1cd293..aeb7050 100644 (file)
@@ -49,8 +49,8 @@ static int webvtt_probe(AVProbeData *p)
 static int64_t read_ts(const char *s)
 {
     int hh, mm, ss, ms;
-    if (sscanf(s, "%u:%u:%u.%u", &hh, &mm, &ss, &ms) == 4) return (hh*3600 + mm*60 + ss) * 1000 + ms;
-    if (sscanf(s,    "%u:%u.%u",      &mm, &ss, &ms) == 3) return (          mm*60 + ss) * 1000 + ms;
+    if (sscanf(s, "%u:%u:%u.%u", &hh, &mm, &ss, &ms) == 4) return (hh*3600LL + mm*60LL + ss) * 1000LL + ms;
+    if (sscanf(s,    "%u:%u.%u",      &mm, &ss, &ms) == 3) return (            mm*60LL + ss) * 1000LL + ms;
     return AV_NOPTS_VALUE;
 }