git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 34c3c5c)
Assert that wrapper_handler()'s argument is within expected range.
Fri, 7 Mar 2025 21:23:09 +0000 (15:23 -0600)
Fri, 7 Mar 2025 21:23:09 +0000 (15:23 -0600)
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


diff --git a/src/port/pqsignal.c b/src/port/pqsignal.c
index 5dd8b76bae802d52c1a0ff576aaf592d9a2b1436..26943845e217909587a5947feafa7ab714bf45fa 100644 (file)
--- 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
/*
@@ -123,6 +126,7 @@ pqsignal(int signo, pqsigfunc func)
struct sigaction act;
#endif
+ Assert(signo > 0);
Assert(signo < PG_NSIG);
if (func != SIG_IGN && func != SIG_DFL)
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /