diff options
author | Douglas Christman <DouglasChristman@gmail.com> | 2016-12-20 16:42:12 -0500 |
---|---|---|
committer | Douglas Christman <DouglasChristman@gmail.com> | 2016-12-20 17:52:55 -0500 |
commit | c0aebb4b3b38caca64ae190f1d523edf46f03969 (patch) | |
tree | 804df8f381b3ea651a2bb6abb0eb883fa25961a4 /src/test | |
parent | 9f702d00d61a9d7bceeb07eced01427a85193021 (diff) |
calendarspec: improve overflow handling
Check if the parsed seconds value fits in an integer *after*
multiplying by USEC_PER_SEC, otherwise a large value can trigger
modulo by zero during normalization.
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/test-calendarspec.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/test/test-calendarspec.c b/src/test/test-calendarspec.c index 5fd749a6a8..1f34a91b10 100644 --- a/src/test/test-calendarspec.c +++ b/src/test/test-calendarspec.c @@ -238,6 +238,8 @@ int main(int argc, char* argv[]) { assert_se(calendar_spec_from_string("*:05..10/6", &c) < 0); assert_se(calendar_spec_from_string("20/4:00", &c) < 0); assert_se(calendar_spec_from_string("00:00/60", &c) < 0); + assert_se(calendar_spec_from_string("00:00:2300", &c) < 0); + assert_se(calendar_spec_from_string("00:00:18446744073709551615", &c) < 0); test_timestamp(); test_hourly_bug_4031(); |