]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-45521: Fix a bug in the obmalloc radix tree code. (GH-29051)
authorNeil Schemenauer <nas-github@arctrix.com>
Thu, 21 Oct 2021 13:38:36 +0000 (06:38 -0700)
committerGitHub <noreply@github.com>
Thu, 21 Oct 2021 13:38:36 +0000 (06:38 -0700)
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.

Misc/NEWS.d/next/Core and Builtins/2021-10-18-22-40-33.bpo-45521.GdMiuW.rst [new file with mode: 0644]
Objects/obmalloc.c

diff --git a/Misc/NEWS.d/next/Core and Builtins/2021-10-18-22-40-33.bpo-45521.GdMiuW.rst b/Misc/NEWS.d/next/Core and Builtins/2021-10-18-22-40-33.bpo-45521.GdMiuW.rst
new file mode 100644 (file)
index 0000000..3a082a4
--- /dev/null
@@ -0,0 +1,3 @@
+Fix a bug in the obmalloc radix tree code.  On 64-bit machines, the bug
+causes the tree to hold 46-bits of virtual addresses, rather than the
+intended 48-bits.
index d8d6f6dea0d532491f504c0a89d9f4434a8aba8c..2eddb2cafd49836187c17e8153ce060a990a0396 100644 (file)
@@ -1341,7 +1341,7 @@ _Py_GetAllocatedBlocks(void)
 
 #define MAP_TOP_BITS INTERIOR_BITS
 #define MAP_TOP_LENGTH (1 << MAP_TOP_BITS)
-#define MAP_TOP_MASK (MAP_BOT_LENGTH - 1)
+#define MAP_TOP_MASK (MAP_TOP_LENGTH - 1)
 
 #define MAP_MID_BITS INTERIOR_BITS
 #define MAP_MID_LENGTH (1 << MAP_MID_BITS)