-
- Notifications
You must be signed in to change notification settings - Fork 306
Description
Steps to reproduce
The following code triggers a MemoryError
in astroid:
A=((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((c,j=t
This bug was discovered by OSS-Fuzz:
https://issues.oss-fuzz.com/issues/380930688 (report not public yet)
Current behavior
Traceback (most recent call last): File "pylint/pylint/lint/pylinter.py", line 976, in get_ast return MANAGER.ast_from_file(filepath, modname, source=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "astroid/astroid/manager.py", line 167, in ast_from_file return AstroidBuilder(self).file_build(filepath, modname) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "astroid/astroid/builder.py", line 144, in file_build module, builder = self._data_build(data, modname, path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "astroid/astroid/builder.py", line 181, in _data_build node, parser_module = _parse_string( ^^^^^^^^^^^^^^ File "astroid/astroid/builder.py", line 476, in _parse_string parsed = parser_module.parse( ^^^^^^^^^^^^^^^^^^^^ File "astroid/astroid/_ast.py", line 29, in parse return ast.parse(string, filename=filename, type_comments=type_comments) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/ast.py", line 52, in parse return compile(source, filename, mode, flags, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ MemoryError: Parser stack overflowed - Python source too complex to parse
Expected behavior
Python also raises a MemoryError
when trying to run the fuzzed A=(((...
code, but maybe astroid can handle ast.parse
failures more gracefully?