Skip to content

Commit 088f8e2

Browse files
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
1 parent 34c3c5c commit 088f8e2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/port/pqsignal.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ wrapper_handler(SIGNAL_ARGS)
8787
{
8888
int save_errno = errno;
8989

90+
Assert(postgres_signal_arg > 0);
91+
Assert(postgres_signal_arg < PG_NSIG);
92+
9093
#ifndef FRONTEND
9194

9295
/*
@@ -123,6 +126,7 @@ pqsignal(int signo, pqsigfunc func)
123126
struct sigaction act;
124127
#endif
125128

129+
Assert(signo > 0);
126130
Assert(signo < PG_NSIG);
127131

128132
if (func != SIG_IGN && func != SIG_DFL)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy