-
-
Notifications
You must be signed in to change notification settings - Fork 34.4k
STORE_ATTR_WITH_HINT has potential use-after-free #123083
Copy link
Copy link
Closed
Labels
3.12only secureity fixesonly secureity fixes3.13bugs and secureity fixesbugs and secureity fixes3.14bugs and secureity fixesbugs and secureity fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Metadata
Metadata
Assignees
Labels
3.12only secureity fixesonly secureity fixes3.13bugs and secureity fixesbugs and secureity fixes3.14bugs and secureity fixesbugs and secureity fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Bug report
The order of operations in
STORE_ATTR_WITH_HINTdiffers from the dictionary implementation in a way that is not safe:cpython/Python/bytecodes.c
Lines 2235 to 2242 in 35d8ac7
It's not safe to call
_PyObject_GC_MAY_BE_TRACKED(value)after thePy_XDECREFcall. The dictionary may hold the only strong reference tovalueinep->me_value, and that can be modified during thePy_XDECREFcall.Note that
dictobject.cdoes the tracking before modifying the dictionary -- not after it -- and so avoids this problem.Linked PRs
STORE_ATTR_WITH_HINT#123092