From: Clément Bœsch Date: Sat, 20 Oct 2012 23:16:49 +0000 (+0200) Subject: lavf/webvttdec: fix potential timing overflows. X-Git-Tag: android-x86-4.4-r1~8675 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=99a520000d376d60cd30fae97bfaaf13d50ee26c;p=android-x86%2Fexternal-ffmpeg.git lavf/webvttdec: fix potential timing overflows. Should fix CID733781 and CID733782. --- 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; }