Use only utf-8 for Pygments (#4859)

See https://github.com/pygments/pygments/issues/1628#issuecomment-747259224
This commit is contained in:
Google AutoFuzz Team 2020-12-17 17:28:47 +01:00 committed by GitHub
parent 77f468e95b
commit 86002c1f47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -22,11 +22,14 @@ import pygments.lexers
def TestOneInput(input_bytes):
fdp = atheris.FuzzedDataProvider(input_bytes)
data = fdp.ConsumeUnicode(atheris.ALL_REMAINING)
try:
lexer = pygments.lexers.guess_lexer(str(input_bytes))
lexer = pygments.lexers.guess_lexer(data)
except ValueError:
return
pygments.highlight(str(input_bytes), lexer, pygments.formatters.HtmlFormatter())
pygments.highlight(data, lexer, pygments.formatters.HtmlFormatter())
def main():