From 86002c1f47f24a7ff879ceee1b9a592805889f00 Mon Sep 17 00:00:00 2001 From: Google AutoFuzz Team Date: Thu, 17 Dec 2020 17:28:47 +0100 Subject: [PATCH] Use only utf-8 for Pygments (#4859) See https://github.com/pygments/pygments/issues/1628#issuecomment-747259224 --- projects/pygments/pygments_fuzzer.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/projects/pygments/pygments_fuzzer.py b/projects/pygments/pygments_fuzzer.py index 1f1c22870..9d21ba320 100644 --- a/projects/pygments/pygments_fuzzer.py +++ b/projects/pygments/pygments_fuzzer.py @@ -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():