lavf/webvttdec: fix potential timing overflows.

Should fix CID733781 and CID733782.
This commit is contained in:
Clément Bœsch 2012-10-21 01:16:49 +02:00
parent 1ea3c03743
commit 99a520000d

View 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;
}