Skip to content

Preventing the use of a null pointer in mro_hierarchy #132835

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
smurav opened this issue Apr 23, 2025 · 0 comments
Open

Preventing the use of a null pointer in mro_hierarchy #132835

smurav opened this issue Apr 23, 2025 · 0 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-crash A hard crash of the interpreter, possibly with a core dump

Comments

@smurav
Copy link
Contributor

smurav commented Apr 23, 2025

In some cases type->tp_mro can be NULL and the new_mro variable can get a null value from the lookup_tp_mro call in the mro_hierarchy function.

PyObject *new_mro = lookup_tp_mro(type);

In this case, there may be problems with calling the Py_NewRef and the Py_DECREF functions.

tuple = PyTuple_Pack(3, type, new_mro, old_mro);

tuple = PyTuple_Pack(2, type, new_mro);

Py_DECREF(new_mro);

Linked PRs

smurav added a commit to smurav/cpython that referenced this issue Apr 23, 2025
@ZeroIntensity ZeroIntensity added interpreter-core (Objects, Python, Grammar, and Parser dirs) type-crash A hard crash of the interpreter, possibly with a core dump labels Apr 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-crash A hard crash of the interpreter, possibly with a core dump
Projects
None yet
Development

No branches or pull requests

2 participants