mirror of
https://github.com/systemd/systemd.git
synced 2024-12-22 17:35:35 +03:00
basic/calendarspec: add check for repeat values that would overflow
https://oss-fuzz.com/v2/issue/4651449704251392/7004
This commit is contained in:
parent
e4711004d6
commit
e127f26b1a
@ -187,6 +187,8 @@ int calendar_spec_normalize(CalendarSpec *c) {
|
||||
}
|
||||
|
||||
_pure_ static bool chain_valid(CalendarComponent *c, int from, int to, bool end_of_month) {
|
||||
assert(to >= from);
|
||||
|
||||
if (!c)
|
||||
return true;
|
||||
|
||||
@ -197,6 +199,10 @@ _pure_ static bool chain_valid(CalendarComponent *c, int from, int to, bool end_
|
||||
if (c->start < from || c->start > to)
|
||||
return false;
|
||||
|
||||
/* Avoid overly large values that could cause overflow */
|
||||
if (c->repeat > to - from)
|
||||
return false;
|
||||
|
||||
/*
|
||||
* c->repeat must be short enough so at least one repetition may
|
||||
* occur before the end of the interval. For dates scheduled
|
||||
|
3
test/fuzz-regressions/fuzz-unit-file/oss-fuzz-7004
Normal file
3
test/fuzz-regressions/fuzz-unit-file/oss-fuzz-7004
Normal file
@ -0,0 +1,3 @@
|
||||
timer
|
||||
[Timer]
|
||||
OnCalendar=*-31/2147483640
|
@ -37,4 +37,5 @@ fuzz_regression_tests = '''
|
||||
fuzz-unit-file/oss-fuzz-6908
|
||||
fuzz-unit-file/oss-fuzz-6897
|
||||
fuzz-unit-file/oss-fuzz-6897-evverx
|
||||
fuzz-unit-file/oss-fuzz-7004
|
||||
'''.split()
|
||||
|
Loading…
Reference in New Issue
Block a user