{{ message }}
bpo-38115: Deal with invalid bytecode offsets in lnotab#16079
Merged
gpshead merged 2 commits intoSep 28, 2019
Merged
Conversation
terrible reasons that are difficult to fix). Make dis.findlinestarts() ignore invalid offsets in lnotab. All other uses of lnotab in CPython (various reimplementations of addr2line or line2addr in Python, C and gdb) already ignore this, because they take an address to look for, instead. Add tests for the result of dis.findlinestarts() on wacky constructs in test_peepholer.py, because it's the easiest place to add them.
zooba
approved these changes
Sep 27, 2019
gpshead
approved these changes
Sep 28, 2019
Contributor
|
Sorry, @Yhg1s and @gpshead, I could not cleanly backport this to |
Sorry, something went wrong.
gpshead
pushed a commit
to gpshead/cpython
that referenced
this pull request
Sep 28, 2019
Document that lnotab can contain invalid bytecode offsets (because of terrible reasons that are difficult to fix). Make dis.findlinestarts() ignore invalid offsets in lnotab. All other uses of lnotab in CPython (various reimplementations of addr2line or line2addr in Python, C and gdb) already ignore this, because they take an address to look for, instead. Add tests for the result of dis.findlinestarts() on wacky constructs in test_peepholer.py, because it's the easiest place to add them. (cherry picked from commit c816503)
gpshead
added a commit
that referenced
this pull request
Sep 28, 2019
…H-16464) Document that lnotab can contain invalid bytecode offsets (because of terrible reasons that are difficult to fix). Make dis.findlinestarts() ignore invalid offsets in lnotab. All other uses of lnotab in CPython (various reimplementations of addr2line or line2addr in Python, C and gdb) already ignore this, because they take an address to look for, instead. Add tests for the result of dis.findlinestarts() on wacky constructs in test_peepholer.py, because it's the easiest place to add them. (cherry picked from commit c816503)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.
For terrible reasons that are difficult to fix, a code object's co_lnotab can contain invalid bytecode offsets (offsets past the end of the bytecode string). Make dis.findlinestarts() ignore invalid offsets in lnotab. All other uses of lnotab in CPython -- various reimplementations of addr2line or line2addr in Python, C and gdb -- already ignore this (because they take an address to look for, instead of parsing the whole thing).
Add tests for the result of dis.findlinestarts() on wacky constructs in test_peepholer.py, because it's the easiest place to add them.
https://bugs.python.org/issue38115