Skip to content

Commit 311910b

Browse files
authored
bpo-45521: Fix a bug in the obmalloc radix tree code. (GH-29051)
MAP_BOT_LENGTH was incorrectly used to compute MAP_TOP_MASK instead of MAP_TOP_LENGTH. On 64-bit machines, the error causes the tree to hold 46-bits of virtual addresses, rather than the intended 48-bits.
1 parent 9942f42 commit 311910b

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Fix a bug in the obmalloc radix tree code. On 64-bit machines, the bug
2+
causes the tree to hold 46-bits of virtual addresses, rather than the
3+
intended 48-bits.

Objects/obmalloc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1341,7 +1341,7 @@ _Py_GetAllocatedBlocks(void)
13411341

13421342
#define MAP_TOP_BITS INTERIOR_BITS
13431343
#define MAP_TOP_LENGTH (1 << MAP_TOP_BITS)
1344-
#define MAP_TOP_MASK (MAP_BOT_LENGTH - 1)
1344+
#define MAP_TOP_MASK (MAP_TOP_LENGTH - 1)
13451345

13461346
#define MAP_MID_BITS INTERIOR_BITS
13471347
#define MAP_MID_LENGTH (1 << MAP_MID_BITS)

0 commit comments

Comments
 (0)