From 0fb6954aa5012fc0c41af364fb328f90e648f6b7 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 27 Mar 2022 12:57:46 -0400 Subject: [PATCH] Fix breakage of get_ps_display() in the PS_USE_NONE case. Commit 8c6d30f21 caused this function to fail to set *displen in the PS_USE_NONE code path. If the variable's previous value had been negative, that'd lead to a memory clobber at some call sites. We'd managed not to notice due to very thin test coverage of such configurations, but this appears to explain buildfarm member lorikeet's recent struggles. Credit to Andrew Dunstan for spotting the problem. Back-patch to v13 where the bug was introduced. Discussion: https://postgr.es/m/136102.1648320427@sss.pgh.pa.us --- src/backend/utils/misc/ps_status.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/backend/utils/misc/ps_status.c b/src/backend/utils/misc/ps_status.c index 20b717e5be2..ec314c03f54 100644 --- a/src/backend/utils/misc/ps_status.c +++ b/src/backend/utils/misc/ps_status.c @@ -443,6 +443,7 @@ get_ps_display(int *displen) return ps_buffer + ps_buffer_fixed_size; #else + *displen = 0; return ""; #endif }