Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

GH-93964: Harden overflow checks before _PyBytes_Resize in compile.c#94044

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
sweeneyde wants to merge8 commits intopython:main
base:main
Choose a base branch
Loading
fromsweeneyde:compile_overflows

Conversation

sweeneyde
Copy link
Member

@sweeneydesweeneyde commentedJun 21, 2022
edited by bedevere-bot
Loading

#93964

The issue was found in 3.10, so it will need to be manually backported there.

@sweeneydesweeneyde marked this pull request as draftJune 21, 2022 03:43
@sweeneydesweeneyde marked this pull request as ready for reviewJune 21, 2022 04:48
@sweeneydesweeneyde added the needs backport to 3.11only security fixes labelJun 21, 2022
Py_ssize_t b_len = PyBytes_GET_SIZE(*bytes);
if (unitsize * logical_length >= b_len - to_add * unitsize) {
// There's not enough room. Double it.
if (b_len > PY_SSIZE_T_MAX / 2) {
Copy link
Member

Choose a reason for hiding this comment

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

This has the same issue as the backport.
We want to be able to index all code object structures with anint, so you'll needINT_MAX instead ofPY_SSIZE_T_MAX and it should be an overflow error, not a memory error.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

To clarify, we wanta_bytecode to be able to haveINT_MAX code units, not justINT_MAX bytes, right?

Copy link
Member

Choose a reason for hiding this comment

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

We probably want the smaller amount to avoid risk of overflow. So the length inbytes should be less thanINT_MAX.

@arhadthedev
Copy link
Member

Is the PR still relevant or some other PR superseded this one?

For merge conflict resolution: touched functions were moved toPython/assemble.c bygh-103277.

cc@iritkatriel

@serhiy-storchakaserhiy-storchaka added needs backport to 3.12only security fixes needs backport to 3.13bugs and security fixes and removed needs backport to 3.11only security fixes labelsMay 9, 2024
@serhiy-storchakaserhiy-storchaka added the needs backport to 3.14bugs and security fixes labelMay 8, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@markshannonmarkshannonmarkshannon left review comments

Assignees
No one assigned
Labels
awaiting core reviewneeds backport to 3.12only security fixesneeds backport to 3.13bugs and security fixesneeds backport to 3.14bugs and security fixes
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

5 participants
@sweeneyde@arhadthedev@markshannon@serhiy-storchaka@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp