From 99a520000d376d60cd30fae97bfaaf13d50ee26c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= Date: Sun, 21 Oct 2012 01:16:49 +0200 Subject: [PATCH] lavf/webvttdec: fix potential timing overflows. Should fix CID733781 and CID733782. --- libavformat/webvttdec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/webvttdec.c b/libavformat/webvttdec.c index b1cd2938ee..aeb705095f 100644 --- a/libavformat/webvttdec.c +++ b/libavformat/webvttdec.c @@ -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; }