-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
bpo-40958: Avoid buffer overflow in the parser when indexing the current line #20875
Conversation
When you're done making the requested changes, leave the comment: |
I have made the requested changes; please review again |
Thanks for making the requested changes! @tiran: please review the changes made to this pull request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! 🎉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks thanks!
@tiran If you have some time today, could you confirm that this solves the ASAN/USAN problem for you? I have checked on my side that this is the case but it would be nice to have independent confirmation. I plan to land this today and do the backport to avoid potential merge conflicts. |
After a rebase to latest master the PR is passing asan/ubsan tests on my F32 machine. |
Thanks @pablogsal for the PR 🌮🎉.. I'm working now to backport this PR to: 3.9. |
GH-20919 is a backport of this pull request to the 3.9 branch. |
…ent line (pythonGH-20875) (cherry picked from commit 51c5896) Co-authored-by: Pablo Galindo <[email protected]>
…ent line (GH-20875) (GH-20919) (cherry picked from commit 51c5896) Co-authored-by: Pablo Galindo <[email protected]>
After thinking a bit more about the whole problem I found that we were processing the offsets incorrectly if the input is raw (no need to transform the offset to a character offset). Once we process the column offsets correctly, is quite straightforward to fix the incorrect access.
As an example of why we were processing the offset incorrectly previously, consider this code (current master without this PR):
while the old parser points correctly to the
$
token:https://bugs.python.org/issue40958