Skip to content

Commit a30a305

Browse files
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 <ianilyasov@outlook.com> Reviewed-by: Robert Haas <robertmhaas@gmail.com> Discussion: https://postgr.es/m/GV1P251MB1004E0D09D117D3CECF9256ECD502@GV1P251MB1004.EURP251.PROD.OUTLOOK.COM Backpatch-through: v12
1 parent 17db543 commit a30a305

File tree

1 file changed

+7
-3
lines changed
  • src/backend/utils/mmgr

1 file changed

+7
-3
lines changed

src/backend/utils/mmgr/dsa.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,9 +1105,13 @@ dsa_dump(dsa_area *area)
11051105
{
11061106
dsa_segment_index segment_index;
11071107

1108-
fprintf(stderr,
1109-
" segment bin %zu (at least %d contiguous pages free):\n",
1110-
i, 1 << (i - 1));
1108+
if (i == 0)
1109+
fprintf(stderr,
1110+
" segment bin %zu (no contiguous free pages):\n", i);
1111+
else
1112+
fprintf(stderr,
1113+
" segment bin %zu (at least %d contiguous pages free):\n",
1114+
i, 1 << (i - 1));
11111115
segment_index = area->control->segment_bins[i];
11121116
while (segment_index != DSA_SEGMENT_INDEX_NONE)
11131117
{

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