Title: Use-after-free in `Context.__eq__` via re-entrant `ContextVar.set` · Issue #142829 · python/cpython · GitHub
Open Graph Title: Use-after-free in `Context.__eq__` via re-entrant `ContextVar.set` · Issue #142829 · python/cpython
X Title: Use-after-free in `Context.__eq__` via re-entrant `ContextVar.set` · Issue #142829 · python/cpython
Description: What happened? Re-entrant ContextVar.set during _PyHamt_Eq lets Context.__eq__ replace a context while hamt_iterator_next still walks the old HAMT nodes, leaving the iterator with freed storage and producing a use-after-free when compari...
Open Graph Description: What happened? Re-entrant ContextVar.set during _PyHamt_Eq lets Context.__eq__ replace a context while hamt_iterator_next still walks the old HAMT nodes, leaving the iterator with freed storage and...
X Description: What happened? Re-entrant ContextVar.set during _PyHamt_Eq lets Context.__eq__ replace a context while hamt_iterator_next still walks the old HAMT nodes, leaving the iterator with freed storage and...
Opengraph URL: https://github.com/python/cpython/issues/142829
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Use-after-free in `Context.__eq__` via re-entrant `ContextVar.set`","articleBody":"### What happened?\n\nRe-entrant `ContextVar.set` during `_PyHamt_Eq` lets `Context.__eq__` replace a context while `hamt_iterator_next` still walks the old HAMT nodes, leaving the iterator with freed storage and producing a use-after-free when comparing two `Context` instances.\n\n**Proof of Concept:**\n```python\nimport contextvars\n\nvar = contextvars.ContextVar(\"v\")\nctx1 = contextvars.Context()\nctx2 = contextvars.Context()\n\n\nclass Boom:\n def __eq__(self, other):\n ctx1.run(lambda: var.set(object()))\n return True\n\n\nctx1.run(var.set, Boom())\nctx2.run(var.set, object())\nctx1 == ctx2\n```\n\n\n**Affected Versions:**\n\u003cdetails>\n\n| Python Version | Status | Exit Code |\n|---|---|---|\n| `Python 3.9.24+ (heads/3.9:111bbc15b26, Oct 27 2025, 21:34:13) ` | ASAN | 1 |\n| `Python 3.10.19+ (heads/3.10:014261980b1, Oct 27 2025, 21:19:00) [Clang 18.1.3 (1ubuntu1)]` | ASAN | 1 |\n| `Python 3.11.14+ (heads/3.11:88f3f5b5f11, Oct 27 2025, 21:20:35) [Clang 18.1.3 (1ubuntu1)]` | ASAN | 1 |\n| `Python 3.12.12+ (heads/3.12:8cb2092bd8c, Oct 27 2025, 21:27:07) [Clang 18.1.3 (1ubuntu1)]` | ASAN | 1 |\n| `Python 3.13.9+ (heads/3.13:9c8eade20c6, Oct 27 2025, 21:28:49) [Clang 18.1.3 (1ubuntu1)]` | ASAN | 1 |\n| `Python 3.14.0+ (heads/3.14:2e216728038, Oct 27 2025, 21:30:55) [Clang 18.1.3 (1ubuntu1)]` | ASAN | 1 |\n| `Python 3.15.0a1+ (heads/main:f5394c257ce, Oct 27 2025, 21:32:37) [Clang 18.1.3 (1ubuntu1)]` | ASAN | 1 |\n\n\u003c/details>\n\n**Vulnerable Code:**\n\u003cdetails>\n\n```c\nint\n_PyHamt_Eq(PyHamtObject *v, PyHamtObject *w)\n{\n if (v == w) {\n return 1;\n }\n\n if (v->h_count != w->h_count) {\n return 0;\n }\n\n PyHamtIteratorState iter;\n hamt_iter_t iter_res;\n hamt_find_t find_res;\n PyObject *v_key;\n PyObject *v_val;\n PyObject *w_val;\n\n hamt_iterator_init(&iter, v->h_root);\n\n do {\n iter_res = hamt_iterator_next(&iter, &v_key, &v_val);\n if (iter_res == I_ITEM) {\n find_res = hamt_find(w, v_key, &w_val);\n switch (find_res) {\n case F_ERROR:\n return -1;\n\n case F_NOT_FOUND:\n return 0;\n\n case F_FOUND: {\n // Bug: Enter the __eq__ method which can tear down the HAMT we’re iterating\n int cmp = PyObject_RichCompareBool(v_val, w_val, Py_EQ);\n if (cmp \u003c 0) {\n return -1;\n }\n if (cmp == 0) {\n return 0;\n }\n }\n }\n }\n } while (iter_res != I_END);\n\n return 1;\n}\n```\n\n\u003c/details>\n\n**Sanitizer Output:**\n\u003cdetails>\n\n```\n=================================================================\n==1348779==ERROR: AddressSanitizer: heap-use-after-free on address 0x5060000cff98 at pc 0x5b670b71e4b3 bp 0x7ffca41ad830 sp 0x7ffca41ad828\nREAD of size 8 at 0x5060000cff98 thread T0\n #0 0x5b670b71e4b2 in _Py_TYPE /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/./Include/object.h:277:20\n #1 0x5b670b71e4b2 in Py_IS_TYPE /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/./Include/object.h:302:12\n #2 0x5b670b71e4b2 in hamt_iterator_next /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Python/hamt.c:2193:9\n #3 0x5b670b71de0a in _PyHamt_Eq /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Python/hamt.c:2341:20\n #4 0x5b670b6c8393 in context_tp_richcompare /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Python/context.c:565:15\n #5 0x5b670b464817 in do_richcompare /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Objects/object.c:1059:15\n #6 0x5b670b464817 in PyObject_RichCompare /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Objects/object.c:1108:21\n #7 0x5b670b65e386 in _PyEval_EvalFrameDefault /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Python/generated_cases.c.h:4683:35\n #8 0x5b670b6463bb in _PyEval_EvalFrame /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/./Include/internal/pycore_ceval.h:121:16\n #9 0x5b670b6463bb in _PyEval_Vector /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Python/ceval.c:2005:12\n #10 0x5b670b6463bb in PyEval_EvalCode /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Python/ceval.c:888:21\n #11 0x5b670b79d370 in run_eval_code_obj /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Python/pythonrun.c:1365:12\n #12 0x5b670b79d370 in run_mod /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Python/pythonrun.c:1459:19\n #13 0x5b670b79743c in pyrun_file /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Python/pythonrun.c:1293:15\n #14 0x5b670b79743c in _PyRun_SimpleFileObject /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Python/pythonrun.c:521:13\n #15 0x5b670b796b05 in _PyRun_AnyFileObject /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Python/pythonrun.c:81:15\n #16 0x5b670b7fefe5 in pymain_run_file_obj /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Modules/main.c:410:15\n #17 0x5b670b7fefe5 in pymain_run_file /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Modules/main.c:429:15\n #18 0x5b670b7fd99d in pymain_run_python /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Modules/main.c:691:21\n #19 0x5b670b7fd99d in Py_RunMain /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Modules/main.c:772:5\n #20 0x5b670b7fe451 in pymain_main /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Modules/main.c:802:12\n #21 0x5b670b7fe5c3 in Py_BytesMain /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Modules/main.c:826:12\n #22 0x779d3a22a1c9 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16\n #23 0x779d3a22a28a in __libc_start_main csu/../csu/libc-start.c:360:3\n #24 0x5b670b1ae104 in _start (/home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/python+0x1c7104) (BuildId: 5de9d2fcbcd44bfc1b0fe256566d49ad35ca1d56)\n\n0x5060000cff98 is located 24 bytes inside of 64-byte region [0x5060000cff80,0x5060000cffc0)\nfreed by thread T0 here:\n #0 0x5b670b248cba in free (/home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/python+0x261cba) (BuildId: 5de9d2fcbcd44bfc1b0fe256566d49ad35ca1d56)\n #1 0x5b670b46ace1 in _Py_Dealloc /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Objects/object.c:3200:5\n #2 0x5b670b71edad in Py_DECREF /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/./Include/refcount.h:420:9\n #3 0x5b670b71edad in hamt_tp_clear /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Python/hamt.c:2606:5\n #4 0x5b670b71edad in hamt_tp_dealloc /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Python/hamt.c:2636:11\n #5 0x5b670b46ace1 in _Py_Dealloc /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Objects/object.c:3200:5\n #6 0x5b670b6c71b6 in Py_DECREF /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/./Include/refcount.h:420:9\n #7 0x5b670b6c71b6 in contextvar_set /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Python/context.c:801:5\n #8 0x5b670b6c71b6 in PyContextVar_Set /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Python/context.c:367:9\n #9 0x5b670b37ea3b in _PyObject_VectorcallTstate /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/./Include/internal/pycore_call.h:169:11\n #10 0x5b670b37ea3b in PyObject_Vectorcall /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Objects/call.c:327:12\n #11 0x5b670b665837 in _PyEval_EvalFrameDefault /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Python/generated_cases.c.h:1620:35\n #12 0x5b670b646a14 in _PyEval_EvalFrame /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/./Include/internal/pycore_ceval.h:121:16\n #13 0x5b670b646a14 in _PyEval_Vector /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Python/ceval.c:2005:12\n #14 0x5b670b6c9b13 in _PyObject_VectorcallTstate /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/./Include/internal/pycore_call.h:169:11\n #15 0x5b670b6c9b13 in context_run /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Python/context.c:728:29\n #16 0x5b670b37ea3b in _PyObject_VectorcallTstate /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/./Include/internal/pycore_call.h:169:11\n #17 0x5b670b37ea3b in PyObject_Vectorcall /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Objects/call.c:327:12\n #18 0x5b670b665837 in _PyEval_EvalFrameDefault /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Python/generated_cases.c.h:1620:35\n #19 0x5b670b646a14 in _PyEval_EvalFrame /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/./Include/internal/pycore_ceval.h:121:16\n #20 0x5b670b646a14 in _PyEval_Vector /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Python/ceval.c:2005:12\n #21 0x5b670b4c4488 in _PyObject_VectorcallTstate /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/./Include/internal/pycore_call.h:169:11\n #22 0x5b670b4c4488 in vectorcall_unbound /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Objects/typeobject.c:3034:12\n #23 0x5b670b4c4488 in maybe_call_special_one_arg /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Objects/typeobject.c:3176:15\n #24 0x5b670b4effc0 in _PyObject_MaybeCallSpecialOneArg /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Objects/typeobject.c:3191:12\n #25 0x5b670b4effc0 in slot_tp_richcompare /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Objects/typeobject.c:10736:21\n #26 0x5b670b464817 in do_richcompare /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Objects/object.c:1059:15\n #27 0x5b670b464817 in PyObject_RichCompare /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Objects/object.c:1108:21\n #28 0x5b670b464397 in PyObject_RichCompareBool /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Objects/object.c:1130:11\n #29 0x5b670b71ddda in _PyHamt_Eq /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Python/hamt.c:2352:31\n #30 0x5b670b6c8393 in context_tp_richcompare /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Python/context.c:565:15\n #31 0x5b670b464817 in do_richcompare /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Objects/object.c:1059:15\n #32 0x5b670b464817 in PyObject_RichCompare /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Objects/object.c:1108:21\n #33 0x5b670b65e386 in _PyEval_EvalFrameDefault /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Python/generated_cases.c.h:4683:35\n #34 0x5b670b6463bb in _PyEval_EvalFrame /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/./Include/internal/pycore_ceval.h:121:16\n #35 0x5b670b6463bb in _PyEval_Vector /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Python/ceval.c:2005:12\n #36 0x5b670b6463bb in PyEval_EvalCode /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Python/ceval.c:888:21\n #37 0x5b670b79d370 in run_eval_code_obj /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Python/pythonrun.c:1365:12\n #38 0x5b670b79d370 in run_mod /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Python/pythonrun.c:1459:19\n #39 0x5b670b79743c in pyrun_file /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Python/pythonrun.c:1293:15\n #40 0x5b670b79743c in _PyRun_SimpleFileObject /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Python/pythonrun.c:521:13\n #41 0x5b670b796b05 in _PyRun_AnyFileObject /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Python/pythonrun.c:81:15\n #42 0x5b670b7fefe5 in pymain_run_file_obj /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Modules/main.c:410:15\n #43 0x5b670b7fefe5 in pymain_run_file /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Modules/main.c:429:15\n #44 0x5b670b7fd99d in pymain_run_python /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Modules/main.c:691:21\n #45 0x5b670b7fd99d in Py_RunMain /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Modules/main.c:772:5\n #46 0x5b670b7fe451 in pymain_main /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Modules/main.c:802:12\n #47 0x5b670b7fe5c3 in Py_BytesMain /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Modules/main.c:826:12\n #48 0x779d3a22a1c9 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16\n #49 0x779d3a22a28a in __libc_start_main csu/../csu/libc-start.c:360:3\n\npreviously allocated by thread T0 here:\n #0 0x5b670b248f53 in malloc (/home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/python+0x261f53) (BuildId: 5de9d2fcbcd44bfc1b0fe256566d49ad35ca1d56)\n #1 0x5b670b7040f8 in _PyObject_MallocWithType /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/./Include/internal/pycore_object_alloc.h:46:17\n #2 0x5b670b7040f8 in gc_alloc /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Python/gc.c:2343:17\n #3 0x5b670b7040f8 in _PyObject_GC_NewVar /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Python/gc.c:2385:25\n #4 0x5b670b71fbda in hamt_node_bitmap_new /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Python/hamt.c:508:12\n #5 0x5b670b71fbda in hamt_node_bitmap_assoc /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Python/hamt.c:874:38\n #6 0x5b670b719f91 in _PyHamt_Assoc /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Python/hamt.c:2222:16\n #7 0x5b670b6c7140 in contextvar_set /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Python/context.c:795:30\n #8 0x5b670b6c7140 in PyContextVar_Set /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Python/context.c:367:9\n #9 0x5b670b6c9b13 in _PyObject_VectorcallTstate /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/./Include/internal/pycore_call.h:169:11\n #10 0x5b670b6c9b13 in context_run /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Python/context.c:728:29\n #11 0x5b670b37ea3b in _PyObject_VectorcallTstate /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/./Include/internal/pycore_call.h:169:11\n #12 0x5b670b37ea3b in PyObject_Vectorcall /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Objects/call.c:327:12\n #13 0x5b670b665837 in _PyEval_EvalFrameDefault /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Python/generated_cases.c.h:1620:35\n #14 0x5b670b6463bb in _PyEval_EvalFrame /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/./Include/internal/pycore_ceval.h:121:16\n #15 0x5b670b6463bb in _PyEval_Vector /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Python/ceval.c:2005:12\n #16 0x5b670b6463bb in PyEval_EvalCode /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Python/ceval.c:888:21\n #17 0x5b670b79d370 in run_eval_code_obj /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Python/pythonrun.c:1365:12\n #18 0x5b670b79d370 in run_mod /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Python/pythonrun.c:1459:19\n #19 0x5b670b79743c in pyrun_file /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Python/pythonrun.c:1293:15\n #20 0x5b670b79743c in _PyRun_SimpleFileObject /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Python/pythonrun.c:521:13\n #21 0x5b670b796b05 in _PyRun_AnyFileObject /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Python/pythonrun.c:81:15\n #22 0x5b670b7fefe5 in pymain_run_file_obj /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Modules/main.c:410:15\n #23 0x5b670b7fefe5 in pymain_run_file /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Modules/main.c:429:15\n #24 0x5b670b7fd99d in pymain_run_python /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Modules/main.c:691:21\n #25 0x5b670b7fd99d in Py_RunMain /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Modules/main.c:772:5\n #26 0x5b670b7fe451 in pymain_main /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Modules/main.c:802:12\n #27 0x5b670b7fe5c3 in Py_BytesMain /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/Modules/main.c:826:12\n #28 0x779d3a22a1c9 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16\n #29 0x779d3a22a28a in __libc_start_main csu/../csu/libc-start.c:360:3\n #30 0x5b670b1ae104 in _start (/home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/python+0x1c7104) (BuildId: 5de9d2fcbcd44bfc1b0fe256566d49ad35ca1d56)\n\nSUMMARY: AddressSanitizer: heap-use-after-free /home/jackfromeast/Desktop/entropy/tasks/reproducexx/targets/cpython-main/./Include/object.h:277:20 in _Py_TYPE\nShadow bytes around the buggy address:\n 0x5060000cfd00: 00 00 07 fa fa fa fa fa 00 00 00 00 00 00 00 00\n 0x5060000cfd80: fa fa fa fa 00 00 00 00 00 00 07 fa fa fa fa fa\n 0x5060000cfe00: 00 00 00 00 00 00 00 00 fa fa fa fa 00 00 00 00\n 0x5060000cfe80: 00 00 00 00 fa fa fa fa fd fd fd fd fd fd fd fa\n 0x5060000cff00: fa fa fa fa fd fd fd fd fd fd fd fd fa fa fa fa\n=>0x5060000cff80: fd fd fd[fd]fd fd fd fd fa fa fa fa fd fd fd fd\n 0x5060000d0000: fd fd fd fa fa fa fa fa fd fd fd fd fd fd fd fd\n 0x5060000d0080: fa fa fa fa 00 00 00 00 00 00 00 00 fa fa fa fa\n 0x5060000d0100: 00 00 00 00 00 00 00 fa fa fa fa fa fd fd fd fd\n 0x5060000d0180: fd fd fd fd fa fa fa fa 00 00 00 00 00 00 00 00\n 0x5060000d0200: fa fa fa fa 00 00 00 00 00 00 00 fa fa fa fa fa\nShadow byte legend (one shadow byte represents 8 application bytes):\n Addressable: 00\n Partially addressable: 01 02 03 04 05 06 07 \n Heap left redzone: fa\n Freed heap region: fd\n Stack left redzone: f1\n Stack mid redzone: f2\n Stack right redzone: f3\n Stack after return: f5\n Stack use after scope: f8\n Global redzone: f9\n Global init order: f6\n Poisoned by user: f7\n Container overflow: fc\n Array cookie: ac\n Intra object redzone: bb\n ASan internal: fe\n Left alloca redzone: ca\n Right alloca redzone: cb\n==1348779==ABORTING\n```\n\n\u003c/details>\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-142905\n* gh-143627\n* gh-143871\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/jackfromeast","@type":"Person","name":"jackfromeast"},"datePublished":"2025-12-16T14:49:29Z","url":"https://github.com/python/cpython/issues/142829"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:edb69446-ed69-c727-a273-ba5fee5b126c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 89DA:24645:17CDCFA:1F60273:6B020853 |
| html-safe-nonce | 317274afa0e5608f564df4e1abe88a4e59057d0ba18fef207f5f9af73f1c6763 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4OURBOjI0NjQ1OjE3Q0RDRkE6MUY2MDI3Mzo2QjAyMDg1MyIsInZpc2l0b3JfaWQiOiIzMjQ2OTM4Mzg1NDEyMjgxMTYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 30729a96e898d4c335407514f4fcee3b434ef5219874055692a3e2684e5bc8d6 |
| hovercard-subject-tag | issue:3735124237 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/142829/issue_layout |
| twitter:image | https://opengraph.githubassets.com/eabc7b9ab97cd32f69ede3cc68f6d582d109c11badbf583af17522bcf485bfa9/python/cpython/issues/142829 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/eabc7b9ab97cd32f69ede3cc68f6d582d109c11badbf583af17522bcf485bfa9/python/cpython/issues/142829 |
| og:image:alt | What happened? Re-entrant ContextVar.set during _PyHamt_Eq lets Context.__eq__ replace a context while hamt_iterator_next still walks the old HAMT nodes, leaving the iterator with freed storage and... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jackfromeast |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width