py-spy
py-spy copied to clipboard
Fix panic in Python 3.12 line number handling
The read_varint function would panic when trying to read past the end of the line table. This fix adds bounds checking and returns Option
Changes:
- Modified read_varint to return Option
and added bounds checking - Modified read_signed_varint to handle the Option return type
- Updated CompactCodeObjectImpl macro to handle Option return types with unwrap_or(0)
Fixes #735
Nice! Do you know what the user-facing effect of this is? What happens when the delta is unwrapped to zero?
@zanieb It will assume that code is on the same line as the previous code and not crash with an index out of bounds error.
thanks for the fix!