Subject: pgsql: Fix integer underflow in shared memory debugging

From: Daniel Gustafsson <[email-masked]>
Date: Thu, 29 Feb 2024 11:44:47 +0000

Fix integer underflow in shared memory debugging

dsa_dump would print a large negative number instead of zero for
segment bin 0.  Fix by explicitly checking for underflow and add
special case for bin 0. Backpatch to all supported versions.

Author: Ian Ilyasov <[email-masked]>
Reviewed-by: Robert Haas <[email-masked]>
Discussion: https://postgr.es/m/[email-masked]
Backpatch-through: v12

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/217928ddb45a8a3b03fc1f9d3d97166f1d9a9d12

Modified Files
--------------
src/backend/utils/mmgr/dsa.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)