Skip to content

Commit 1cdac61

Browse files
bpo-45521: Fix a bug in the obmalloc radix tree code. (GH-29051) (GH-29122)
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. (cherry picked from commit 311910b)
1 parent 00ddc1f commit 1cdac61

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
@@ -1328,7 +1328,7 @@ _Py_GetAllocatedBlocks(void)
13281328

13291329
#define MAP_TOP_BITS INTERIOR_BITS
13301330
#define MAP_TOP_LENGTH (1 << MAP_TOP_BITS)
1331-
#define MAP_TOP_MASK (MAP_BOT_LENGTH - 1)
1331+
#define MAP_TOP_MASK (MAP_TOP_LENGTH - 1)
13321332

13331333
#define MAP_MID_BITS INTERIOR_BITS
13341334
#define MAP_MID_LENGTH (1 << MAP_MID_BITS)

0 commit comments

Comments
 (0)