Skip to content

bpo-36421: Fix a possible double decref in _ctypes.c's PyCArrayType_new()#12530

Merged
serhiy-storchaka merged 1 commit into
python:masterfrom
ZackerySpytz:bpo-36421-double-decref-_ctypes
Mar 25, 2019
Merged

bpo-36421: Fix a possible double decref in _ctypes.c's PyCArrayType_new()#12530
serhiy-storchaka merged 1 commit into
python:masterfrom
ZackerySpytz:bpo-36421-double-decref-_ctypes

Conversation

@ZackerySpytz

@ZackerySpytz ZackerySpytz commented Mar 25, 2019

Copy link
Copy Markdown
Contributor

Set type_attr to NULL after the assignment to stgdict->proto (like
what is done with stgdict after the Py_SETREF() call) so that it is
not decrefed twice on error.

https://bugs.python.org/issue36421

…ew()

Set type_attr to NULL after the assignment to stgdict->proto (like
what is done with stgdict after the Py_SETREF() call) so that it is
not decrefed twice on error.
@serhiy-storchaka
serhiy-storchaka merged commit 5e33378 into python:master Mar 25, 2019
@serhiy-storchaka serhiy-storchaka added type-bug An unexpected behavior, bug, or error needs backport to 2.7 labels Mar 25, 2019
@miss-islington

Copy link
Copy Markdown
Contributor

Thanks @ZackerySpytz for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 2.7.
🐍🍒⛏🤖

@miss-islington

Copy link
Copy Markdown
Contributor

Thanks @ZackerySpytz for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7.
🐍🍒⛏🤖

@miss-islington

Copy link
Copy Markdown
Contributor

Sorry, @ZackerySpytz and @serhiy-storchaka, I could not cleanly backport this to 2.7 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 5e333784f007950f22de44c1ffab5b0c03d6691f 2.7

@bedevere-bot

Copy link
Copy Markdown

GH-12533 is a backport of this pull request to the 3.7 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 25, 2019
…ew(). (pythonGH-12530)

Set type_attr to NULL after the assignment to stgdict->proto (like
what is done with stgdict after the Py_SETREF() call) so that it is
not decrefed twice on error.
(cherry picked from commit 5e33378)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
miss-islington added a commit that referenced this pull request Mar 25, 2019
…ew(). (GH-12530)

Set type_attr to NULL after the assignment to stgdict->proto (like
what is done with stgdict after the Py_SETREF() call) so that it is
not decrefed twice on error.
(cherry picked from commit 5e33378)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
@ZackerySpytz

Copy link
Copy Markdown
Contributor Author

Hi, @serhiy-storchaka. Thank you for the review and merge.
This bug is not present in 2.7. However, there are other reference counting bugs in PyCArrayType_new() in 2.7. I'll create a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type-bug An unexpected behavior, bug, or error

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants