diff --git a/projects/pygments/fuzz_guesser.py b/projects/pygments/fuzz_guesser.py index 30348c79a..de9565884 100644 --- a/projects/pygments/fuzz_guesser.py +++ b/projects/pygments/fuzz_guesser.py @@ -22,6 +22,9 @@ import pygments.lexers import pygments.util def TestOneInput(data: bytes) -> int: + if len(data) > (2 << 18): + return + try: lexer = pygments.lexers.guess_lexer(str(data)) except pygments.util.ClassNotFound: diff --git a/projects/pygments/fuzz_lexers.py b/projects/pygments/fuzz_lexers.py index dfff7d29c..97e4cedf9 100644 --- a/projects/pygments/fuzz_lexers.py +++ b/projects/pygments/fuzz_lexers.py @@ -32,6 +32,8 @@ FORMATTERS = [BBCodeFormatter(), GroffFormatter(), HtmlFormatter(), def TestOneInput(data: bytes) -> int: + if len(data) > (2 << 18): + return fdp = atheris.FuzzedDataProvider(data) random_lexer = pygments.lexers.get_lexer_by_name(fdp.PickValueInList(LEXERS)) formatter = fdp.PickValueInList(FORMATTERS)