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

Missing Py_DECREF for load_build in _pickle.c #126991

Closed
Legoclones opened this issue Nov 19, 2024 · 1 comment
Closed

Missing Py_DECREF for load_build in _pickle.c #126991

Legoclones opened this issue Nov 19, 2024 · 1 comment
Labels
3.12 bugs and security fixes 3.13 bugs and security fixes 3.14 new features, bugs and security fixes extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error

Comments

@Legoclones
Copy link
Contributor

Legoclones commented Nov 19, 2024

Bug report

Bug description:

In the load_build function of Modules/_pickle.c, if setting a value in a dictionary fails, the dict variable does not have its reference counter decreased.

Pull request was made at #126990

CPython versions tested on:

3.11

Operating systems tested on:

Linux

Linked PRs

@Legoclones Legoclones added the type-bug An unexpected behavior, bug, or error label Nov 19, 2024
@ZeroIntensity ZeroIntensity added extension-modules C modules in the Modules dir 3.12 bugs and security fixes 3.13 bugs and security fixes 3.14 new features, bugs and security fixes labels Nov 19, 2024
serhiy-storchaka pushed a commit that referenced this issue Nov 19, 2024
…6990)

If PyObject_SetItem() fails in the `load_build()` function of _pickle.c, no DECREF for the `dict` variable.
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Nov 19, 2024
…ythonGH-126990)

If PyObject_SetItem() fails in the `load_build()` function of _pickle.c, no DECREF for the `dict` variable.
(cherry picked from commit 29cbcbd)

Co-authored-by: Justin Applegate <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Nov 19, 2024
…ythonGH-126990)

If PyObject_SetItem() fails in the `load_build()` function of _pickle.c, no DECREF for the `dict` variable.
(cherry picked from commit 29cbcbd)

Co-authored-by: Justin Applegate <[email protected]>
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Nov 19, 2024
This catches a memory leak in loading the BUILD opcode.
@colesbury colesbury changed the title Missing PyDECREF for load_build in _pickle.c Missing Py_DECREF for load_build in _pickle.c Nov 19, 2024
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Nov 19, 2024
This catches a memory leak in loading the BUILD opcode.
serhiy-storchaka pushed a commit that referenced this issue Nov 19, 2024
…GH-126990) (GH-127019)

If PyObject_SetItem() fails in the `load_build()` function of _pickle.c, no DECREF for the `dict` variable.
(cherry picked from commit 29cbcbd)

Co-authored-by: Justin Applegate <[email protected]>
serhiy-storchaka pushed a commit that referenced this issue Nov 19, 2024
…GH-126990) (GH-127018)

If PyObject_SetItem() fails in the `load_build()` function of _pickle.c, no DECREF for the `dict` variable.
(cherry picked from commit 29cbcbd)

Co-authored-by: Justin Applegate <[email protected]>
@serhiy-storchaka
Copy link
Member

Thank you for your contribution @Legoclones. #127031 adds a test for this leak, as well as coverage tests for other corner cases.

serhiy-storchaka added a commit that referenced this issue Nov 20, 2024
This catches a memory leak in loading the BUILD opcode.
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Nov 20, 2024
…127031)

This catches a memory leak in loading the BUILD opcode.
(cherry picked from commit addb225)

Co-authored-by: Serhiy Storchaka <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Nov 20, 2024
…127031)

This catches a memory leak in loading the BUILD opcode.
(cherry picked from commit addb225)

Co-authored-by: Serhiy Storchaka <[email protected]>
serhiy-storchaka added a commit that referenced this issue Nov 20, 2024
… (GH-127064)

This catches a memory leak in loading the BUILD opcode.
(cherry picked from commit addb225)

Co-authored-by: Serhiy Storchaka <[email protected]>
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 3.13 bugs and security fixes 3.14 new features, bugs and security fixes extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

3 participants