You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reject start_pos > end_pos in parser/lexer entrypoints
`alloc_parser_from_buffer` and `alloc_lexer_from_buffer` in the C
extension already rejected negative positions, but accepted ranges
where `start_pos > end_pos`. The lexer's main loop condition is
`current.byte_pos == end_pos`, so a reversed range never terminates:
`current` advances past `end_pos` and the equality is never satisfied,
producing an infinite loop with the GVL held (SIGINT ineffective).
Add the new guard alongside the existing negative-position check and
extract both into a `validate_position_range` helper shared by both
entrypoints.
Minimal reproducer (public API, used to hang indefinitely):
RBS::Parser.parse_type("", byte_range: 1..0)
Found by fuzzing the parser entry points with randomized position
arguments.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments