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

gh-83004: Harden msvcrt init #103383

Merged
merged 3 commits into from
Apr 10, 2023
Merged

Conversation

erlend-aasland
Copy link
Contributor

@erlend-aasland erlend-aasland commented Apr 8, 2023

@erlend-aasland erlend-aasland marked this pull request as draft April 8, 2023 22:35
@erlend-aasland erlend-aasland marked this pull request as ready for review April 8, 2023 23:03
@erlend-aasland
Copy link
Contributor Author

erlend-aasland commented Apr 10, 2023

Darn, I forgot to add error handling for PyDict_SetItemString. I'll create a follow-up PR for that: gh-103420

Comment on lines +673 to +676
if (version == NULL) {
goto error;
}
st = PyModule_AddObjectRef(m, "CRT_ASSEMBLY_VERSION", version);
Copy link
Member

Choose a reason for hiding this comment

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

@erlend-aasland Just FYI, the modsupport functions allow passing in NULL provided an error has already occurred, and they just let it chain. So the code here was fine before.

No need to revert now though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

TIL! Sorry for not waiting on your review.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

However, there was a leak if PyModule_AddObject failed, since that API only eat refs if successful.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry I should have been more careful in this.

warsaw pushed a commit to warsaw/cpython that referenced this pull request Apr 11, 2023
aisk pushed a commit to aisk/cpython that referenced this pull request Apr 18, 2023
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.

None yet

4 participants