-
Notifications
You must be signed in to change notification settings - Fork 764
Closed
Milestone
Description
While working on #1425 I used Hypothesis to help me identify JSON lexing issues.
Hypothesis immediately reported a crash bug in the TNT lexer. It crashes with an IndexError if you pass 0 as the input string:
>>> import pygments.lexers
>>> list(pygments.lexers.TNTLexer().get_tokens('0'))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Kurt\Documents\dev\pygments\pygments\lexer.py", line 188, in streamer
for _, t, v in self.get_tokens_unprocessed(text):
File "C:\Users\Kurt\Documents\dev\pygments\pygments\lexers\tnt.py", line 215, in get_tokens_unprocessed
start = end = self.formula(start, text)
File "C:\Users\Kurt\Documents\dev\pygments\pygments\lexers\tnt.py", line 107, in formula
if text[start] in '[]': # fantasy push or pop
IndexError: string index out of range
Metadata
Metadata
Assignees
Labels
No labels