mirror of
https://github.com/systemd/systemd.git
synced 2026-08-03 22:50:29 +00:00
sd-event: add assert to help static analysis trace signal bounds
Coverity flags the signal_sources array access as a potential
out-of-bounds read because it cannot trace through the SIGNAL_VALID()
macro to know that ssi_signo < _NSIG. Add an explicit assert after
the runtime check to make the constraint visible to static analyzers.
CID#1548033
Follow-up for 7a64c5f23e
This commit is contained in:
@@ -3807,6 +3807,9 @@ static int process_signal(sd_event *e, struct signal_data *d, uint32_t events, i
|
||||
if (_unlikely_(!SIGNAL_VALID(si.ssi_signo)))
|
||||
return -EIO;
|
||||
|
||||
/* Silence static analyzers */
|
||||
assert(si.ssi_signo < _NSIG);
|
||||
|
||||
if (e->signal_sources)
|
||||
s = e->signal_sources[si.ssi_signo];
|
||||
if (!s)
|
||||
|
||||
Reference in New Issue
Block a user