Skip to content

Commit e7a123f

Browse files
committed
Catch exception in python-env
1 parent f8f014d commit e7a123f

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

regexploit/bin/regexploit-python-env

+7-3
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,13 @@ def main():
3939
hooked_regex: regexploit.hook.CompiledRegex
4040
for hooked_regex in regexploit.hook.get_and_clear_regexes():
4141
output.next()
42-
parsed = SreOpParser().parse_sre(
43-
hooked_regex.pattern, hooked_regex.flags
44-
)
42+
try:
43+
parsed = SreOpParser().parse_sre(
44+
hooked_regex.pattern, hooked_regex.flags
45+
)
46+
except Exception as e:
47+
print(f"Error parsing regex {hooked_regex.pattern} from {p}: {e}")
48+
continue
4549
for redos in find(parsed):
4650
if redos.starriness > 2:
4751
output.record(

regexploit/bin/regexploit_python_ast.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def handle_file(filename: str, output: TextOutput):
3232
except re.error:
3333
continue # We will have many strings which aren't actually regexes
3434
except UnsupportedSreOpException as e:
35-
print(f"Error parsing regex: {regex.pattern} from {filename}: {e}")
35+
print(f"Error parsing regex {regex.pattern} from {filename}: {e}")
3636
continue
3737
try:
3838
output.next()

0 commit comments

Comments
 (0)