LOAD_ATTR_SLOT
and STORE_ATTR_SLOT
don't check the owner's type
#99257
Labels
3.11
only security fixes
3.12
only security fixes
interpreter-core
(Objects, Python, Grammar, and Parser dirs)
release-blocker
type-crash
A hard crash of the interpreter, possibly with a core dump
When specializing
LOAD_ATTR_SLOT
, we don't check whether the given member descriptor is valid for the type we got it from.Here is a problematic example, where one class "borrows" a slot from another:
The unspecialized code behaves correctly:
However, the specialized code crashes, since it is accessing memory past the end of the object:
We can fix this by performing the same check that the member descriptor performs (
PyObject_TypeCheck(obj, descr->d_type)
) when specializing.CC @markshannon
The text was updated successfully, but these errors were encountered: