Skip to content

Commit c3510cf

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 5c8dcf9 commit c3510cf

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
/*
@@ -139,6 +142,7 @@ pqsignal(int signo, pqsigfunc func)
139142
pqsigfunc ret;
140143
#endif
141144

145+
Assert(signo > 0);
142146
Assert(signo < PG_NSIG);
143147

144148
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