GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||
GeezerVison is showing github.com — GH-93964: Harden overflow checks before _PyBytes_Resize in compile.c by sweeneyde · Pull Request #94044 · python/cpython Conversation
|
| 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) { |
There was a problem 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 an int, so you'll need INT_MAX instead of PY_SSIZE_T_MAX and it should be an overflow error, not a memory error.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
To clarify, we want a_bytecode to be able to have INT_MAX code units, not just INT_MAX bytes, right?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem 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 in bytes should be less than INT_MAX.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Is the PR still relevant or some other PR superseded this one? For merge conflict resolution: touched functions were moved to cc @iritkatriel |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
This PR is stale because it has been open for 30 days with no activity. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
This PR is stale because it has been open for 90 days with no activity. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Rebase review found this PR unportable: the assembler has since moved from compile.c to assemble.c and was rewritten around PyBytesWriter, so this 2022 hardening no longer applies; its issue gh-93964 is already closed. Closing to cull the number of open pull requests. If the hardening is still wanted, please open a new PR against the current assembler rather than reopening this one. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.