Skip to content

[Skip Issue] Fix some minor bugs in _elementtree.c #10060

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

Merged

Conversation

ZackerySpytz
Copy link
Contributor

No description provided.

@@ -3338,7 +3339,6 @@ _elementtree_XMLParser___init___impl(XMLParserObject *self, PyObject *target,
if (!target) {
Py_CLEAR(self->entity);
Py_CLEAR(self->names);
EXPAT(ParserFree)(self->parser);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this is removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self->parser would be freed again during deallocation, which would cause a crash.

@miss-islington
Copy link
Contributor

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

@bedevere-bot
Copy link

GH-10066 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 Oct 23, 2018
References could leak, NULL could be dereferenced, and the Expat parser could
be double freed when some errors raised.
(cherry picked from commit 9f3ed3e)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
@bedevere-bot
Copy link

GH-10067 is a backport of this pull request to the 3.6 branch.

@miss-islington
Copy link
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 9f3ed3e213b30059087d059a7d1d3b2527fa8654 2.7

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 23, 2018
References could leak, NULL could be dereferenced, and the Expat parser could
be double freed when some errors raised.
(cherry picked from commit 9f3ed3e)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
@serhiy-storchaka
Copy link
Member

Thank you @ZackerySpytz. Nice patch.

Perhaps some bugs exist in 2.7 too, but sources are too different for automatic merge. Do you mind to make a backport manually if it is necessary?

miss-islington added a commit that referenced this pull request Oct 23, 2018
References could leak, NULL could be dereferenced, and the Expat parser could
be double freed when some errors raised.
(cherry picked from commit 9f3ed3e)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
miss-islington added a commit that referenced this pull request Oct 23, 2018
References could leak, NULL could be dereferenced, and the Expat parser could
be double freed when some errors raised.
(cherry picked from commit 9f3ed3e)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
@ZackerySpytz
Copy link
Contributor Author

I will create a backport to 2.7, Serhiy.

ZackerySpytz added a commit to ZackerySpytz/cpython that referenced this pull request Oct 24, 2018
Don't leak a reference if PyDict_Update() fails, check the
PyList_New() call in treebuilder_new(), and properly handle failures
in xmlparser().

(cherry picked from commit 9f3ed3e)
@bedevere-bot
Copy link

GH-10080 is a backport of this pull request to the 2.7 branch.

serhiy-storchaka pushed a commit that referenced this pull request Oct 26, 2018
Don't leak a reference if PyDict_Update() fails, check the
PyList_New() call in treebuilder_new(), and properly handle failures
in xmlparser().

(cherry picked from commit 9f3ed3e)
@bedevere-bot
Copy link

Hi! The buildbot x86 Windows XP VS9.0 2.7 has failed when building commit e131c7c.

You can take a look here:

https://buildbot.python.org/all/#builders/105/builds/270

@serhiy-storchaka serhiy-storchaka removed their assignment Oct 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants