diff --git a/src/shared/calendarspec.c b/src/shared/calendarspec.c index b162224d9d..db6a103c42 100644 --- a/src/shared/calendarspec.c +++ b/src/shared/calendarspec.c @@ -659,6 +659,10 @@ static int prepend_component(const char **p, bool usec, unsigned nesting, Calend /* If no repeat value is specified for the µs component, then let's explicitly refuse ranges * below 1s because our default repeat granularity is beyond that. */ + /* Overflow check */ + if (start > INT_MAX - repeat) + return -ERANGE; + if (usec && stop >= 0 && start + repeat > stop) return -EINVAL; } diff --git a/test/fuzz/fuzz-calendarspec/oss-fuzz-22208 b/test/fuzz/fuzz-calendarspec/oss-fuzz-22208 new file mode 100644 index 0000000000..2bbe7628d6 --- /dev/null +++ b/test/fuzz/fuzz-calendarspec/oss-fuzz-22208 @@ -0,0 +1 @@ +4:3:2147..2 \ No newline at end of file