Skip to content
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

PyObject_GC_Resize doesn't check preheader size #101408

Closed
colesbury opened this issue Jan 29, 2023 · 3 comments
Closed

PyObject_GC_Resize doesn't check preheader size #101408

colesbury opened this issue Jan 29, 2023 · 3 comments
Labels
3.12 bugs and security fixes topic-C-API type-bug An unexpected behavior, bug, or error

Comments

@colesbury
Copy link
Contributor

colesbury commented Jan 29, 2023

The PyObject_GC_Resize implementation in the main branch doesn't check if the object has a preheader:

cpython/Modules/gcmodule.c

Lines 2357 to 2358 in 0ef92d9

PyGC_Head *g = AS_GC(op);
g = (PyGC_Head *)PyObject_Realloc(g, sizeof(PyGC_Head) + basicsize);

The only internal use I see is by _PyTuple_Resize which doesn't have a preheader, but the PyObject_GC_Resize function is publicly documented.

Linked PRs

@corona10
Copy link
Member

@colesbury Patch is merged, but I left the issue open for the test code.

@erlend-aasland
Copy link
Contributor

@corona10: what is the status on test code? 😄

@corona10
Copy link
Member

corona10 commented Jan 6, 2024

@erlend-aasland Nah, let's close the issue until it needs (no bandwidth to work with these days)

@corona10 corona10 closed this as completed Jan 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.12 bugs and security fixes topic-C-API type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

4 participants