Skip to content

bpo-45329: Fix freed memory access in pyexpat.c #28649

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
merged 5 commits into from
Oct 2, 2021

Conversation

y-tag
Copy link
Contributor

@y-tag y-tag commented Sep 30, 2021

https://bugs.python.org/issue45329

  • xmlparse_clear(self) calls clear_handlers(self, 0)
  • clear_handlers(self, 0) accesses self->itself
  • Therefore xmlparse_clear(self) would be done before XML_ParserFree(self->itself)

https://bugs.python.org/issue45329

@serhiy-storchaka serhiy-storchaka added needs backport to 3.9 only security fixes needs backport to 3.10 only security fixes type-bug An unexpected behavior, bug, or error labels Oct 1, 2021
@serhiy-storchaka
Copy link
Member

LGTM, but please add a NEWS entry. https://blurb-it.herokuapp.com/

@y-tag
Copy link
Contributor Author

y-tag commented Oct 1, 2021

I found that the segmentation fault occurs with expat 2.2.0 or earlier.
Null check has been added to 2.2.1.
Since the expat included in this repositry has been updated to 2.4.1, the segmentation fault does not occur with it.
Some tests are failed with ./configure --with-system-expat on CentOS 7, which includes expat 2.1.0.

So this patch might be useful on system which uses old expat...

@serhiy-storchaka serhiy-storchaka merged commit 0742abd into python:main Oct 2, 2021
@miss-islington
Copy link
Contributor

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

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 2, 2021
(cherry picked from commit 0742abd)

Co-authored-by: TAGAMI Yukihiro <[email protected]>
@bedevere-bot
Copy link

GH-28692 is a backport of this pull request to the 3.10 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.10 only security fixes label Oct 2, 2021
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 2, 2021
(cherry picked from commit 0742abd)

Co-authored-by: TAGAMI Yukihiro <[email protected]>
@bedevere-bot bedevere-bot removed the needs backport to 3.9 only security fixes label Oct 2, 2021
@bedevere-bot
Copy link

GH-28693 is a backport of this pull request to the 3.9 branch.

@y-tag y-tag deleted the pyexpat-freed-memory branch October 2, 2021 11:20
miss-islington added a commit that referenced this pull request Oct 2, 2021
(cherry picked from commit 0742abd)

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

Thank you for your contribution TAGAMI-san!

@y-tag
Copy link
Contributor Author

y-tag commented Oct 2, 2021

Thank you too! 😃

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