switch(c) {
case 'H':
case 'J':
- val = date_get_num(&p, 0, c == 'H' ? 23 : INT_MAX, 2);
+ val = date_get_num(&p, 0, c == 'H' ? 23 : INT_MAX, c == 'H' ? 2 : 4);
if (val == -1)
return NULL;
if (*q)
return AVERROR(EINVAL);
- if (INT64_MAX / suffix < t)
+ if (INT64_MAX / suffix < t || t < INT64_MIN / suffix)
return AVERROR(ERANGE);
t *= suffix;
if (INT64_MAX - microseconds < t)
return AVERROR(ERANGE);
t += microseconds;
+ if (t == INT64_MIN && negative)
+ return AVERROR(ERANGE);
*timeval = negative ? -t : t;
return 0;
}