bpo-40958: Avoid buffer overflow in the parser when indexing the current line#20875
bpo-40958: Avoid buffer overflow in the parser when indexing the current line#20875pablogsal merged 4 commits intopython:masterfrom
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. |
|
@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