diff options
| author | Nathan Bossart | 2025-03-07 21:23:09 +0000 |
|---|---|---|
| committer | Nathan Bossart | 2025-03-07 21:23:09 +0000 |
| commit | c3510cfc8b401d61812713c4ccf040125dc7ce1b (patch) | |
| tree | 0ff3318b1a86172d22b8aa7529359076198e4f3e /src | |
| parent | 5c8dcf9483349f39ee8da965c3acd3a61cf242fe (diff) | |
Assert that wrapper_handler()'s argument is within expected range.
pqsignal() already does a similar check, but strange Valgrind
reports have us wondering if wrapper_handler() is somehow getting
called with an invalid signal number.
Reported-by: Tomas Vondra <tomas@vondra.me>
Suggested-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/ace01111-f9ac-4f61-b1b1-8e9379415444%40vondra.me
Backpatch-through: 17
Diffstat (limited to 'src')
| -rw-r--r-- | src/port/pqsignal.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/port/pqsignal.c b/src/port/pqsignal.c index bbd28da0805..9dadce8357d 100644 --- a/src/port/pqsignal.c +++ b/src/port/pqsignal.c @@ -87,6 +87,9 @@ wrapper_handler(SIGNAL_ARGS) { int save_errno = errno; + Assert(postgres_signal_arg > 0); + Assert(postgres_signal_arg < PG_NSIG); + #ifndef FRONTEND /* @@ -139,6 +142,7 @@ pqsignal(int signo, pqsigfunc func) pqsigfunc ret; #endif + Assert(signo > 0); Assert(signo < PG_NSIG); if (func != SIG_IGN && func != SIG_DFL) |
