Skip to content

gh-105979: Fix exception handling in unmarshal_frozen_code (Python/import.c) #105980

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
Jun 22, 2023
Merged

gh-105979: Fix exception handling in unmarshal_frozen_code (Python/import.c) #105980

merged 5 commits into from
Jun 22, 2023

Conversation

chgnrdv
Copy link
Contributor

@chgnrdv chgnrdv commented Jun 22, 2023

Fixes #105979

Clear exception that is set in PyMarshal_ReadObjectFromString when it fails to unmarshal given data. It will prevent calling PyUnicode_FromFormat in set_frozen_error with exception set

chgnrdv added 2 commits June 22, 2023 02:50
Clear exception that is set if function fails to unmarshal given data. It will prevent calling 'PyUnicode_FromFormat' in 'set_frozen_error' with exception set
Copy link
Contributor

@kumaraditya303 kumaraditya303 left a comment

Choose a reason for hiding this comment

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

LGTM, please add a short news entry.

@kumaraditya303 kumaraditya303 enabled auto-merge (squash) June 22, 2023 20:59
@kumaraditya303 kumaraditya303 merged commit cd52803 into python:main Jun 22, 2023
@chgnrdv
Copy link
Contributor Author

chgnrdv commented Jun 23, 2023

@kumaraditya303, sorry for being late, but I can reproduce the issue on 3.11.4 too. Should these changes be backported then?

@kumaraditya303 kumaraditya303 added needs backport to 3.11 only security fixes needs backport to 3.12 only security fixes labels Jun 24, 2023
@miss-islington
Copy link
Contributor

Thanks @chgnrdv for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Thanks @chgnrdv for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Sorry @chgnrdv and @kumaraditya303, I had trouble checking out the 3.11 backport branch.
Please retry by removing and re-adding the "needs backport to 3.11" label.
Alternatively, you can backport using cherry_picker on the command line.
cherry_picker cd5280367a3a7065d13b8f7234474f7a2e9a18fd 3.11

@kumaraditya303 kumaraditya303 added needs backport to 3.11 only security fixes and removed needs backport to 3.11 only security fixes labels Jun 24, 2023
@miss-islington
Copy link
Contributor

Thanks @chgnrdv for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 24, 2023
…Python/import.c`) (pythonGH-105980)

(cherry picked from commit cd52803)

Co-authored-by: chgnrdv <[email protected]>
@miss-islington
Copy link
Contributor

Sorry, @chgnrdv and @kumaraditya303, I could not cleanly backport this to 3.11 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker cd5280367a3a7065d13b8f7234474f7a2e9a18fd 3.11

@bedevere-bot
Copy link

GH-106055 is a backport of this pull request to the 3.12 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.12 only security fixes label Jun 24, 2023
@bedevere-bot
Copy link

GH-106100 is a backport of this pull request to the 3.11 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.11 only security fixes label Jun 26, 2023
kumaraditya303 pushed a commit that referenced this pull request Jun 26, 2023
…`Python/import.c`) (GH-105980) (#106055)

gh-105979: Fix exception handling in `unmarshal_frozen_code` (`Python/import.c`) (GH-105980)
(cherry picked from commit cd52803)

Co-authored-by: chgnrdv <[email protected]>
kumaraditya303 added a commit that referenced this pull request Jun 26, 2023
…ython/import.c`) (GH-105980). (#106100)

* [3.11] gh-105979: Fix exception handling in `unmarshal_frozen_code` (`Python/import.c`) (GH-105980).
(cherry picked from commit cd52803)

Co-authored-by: chgnrdv <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Assertion failure in _imp.get_frozen_object if data object contains bad marshal data
4 participants