Skip to content

Commit

Permalink
Avoid RecursionError on bad python code
Browse files Browse the repository at this point in the history
  • Loading branch information
b-c-ds authored and bcaller committed Dec 24, 2020
1 parent d677a13 commit 2b3b7c0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions regexploit/bin/regexploit_python_ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ def handle_file(filename: str, output: TextOutput):
code = f.read()
try:
code_ast = ast.parse(code)
pnv = PythonNodeVisitor()
pnv.visit(code_ast)
except RecursionError:
print(f"RecursionError parsing AST for {filename}")
return
except SyntaxError:
print(f"Bad Python3 syntax in {filename}")
return
pnv = PythonNodeVisitor()
pnv.visit(code_ast)
for regex in pnv.patterns:
first_for_regex = True
try:
Expand Down

0 comments on commit 2b3b7c0

Please sign in to comment.