-
Notifications
You must be signed in to change notification settings - Fork 483
Formalize linetable parsing and propagate out-of-bounds errors #755
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
base: master
Are you sure you want to change the base?
Conversation
|
Updated the PR to include a fix for an off-by-one introduced by #635, trivially reproducible with the following: |
Let's change only what's needed for the fix, so that it's easier to cherry-pick & revert & reason about |
|
@benfred can approve this workflow so the build can run? Otherwise this LGTM, and we've manually built it and confirmed it's fixed the issues we were seeing. |
I believe that this branch needs to be updated to the latest master first (both to get some CI fixes in - and to let me approve the workflow run) - and I don't seem to have permissions on this branch to update it myself =( |
|
I suggest we also fix int overflows either in the same PR or in a followup, so that debug builds of pyspy will not panic |
|
Updated! @benfred thanks for taking a look. |
Basically every time some uncontrolled user-provided number (from the linetable) is added, subtracted, or shifted, etc. Btw, I am not a maintainer here, this is just a suggestion for improvements. Maybe even better to do as a separate change. Feel free to ignore. Thank you for working on this! |
I believe this is fixed by #751 - can you verify if this still happens with the latest code? Also, There was also an alternative fix for the same linetable problem in #736 - I've merged that one since it passed CI and I want to get a release out. I like the unittests that you've added here though, any chance that you can merge in the other PR here so we can get those tests included? |
We've noticed a transient issue where
py-spywill abort due to unmet assumptions about the contents ofco_linetable(for example we've seen[231], which doesn't even satisfy the internal specification). To address this, I've patched theco_linetableparsing to propagate out-of-bounds errors so that the samples are simply ignored (and a warning is raised).This change is not as minimal as it could be, for example it reorders a couple lines in
python_interpreters.rsfor clarity. If that's a problem, I'd be happy to go back and pare down such changes.Taking a glance, I would guess this is the root cause for #735 and #569, although I have no explanation for why the
co_linetable's appear invalid.