Skip to content

Commit

Permalink
Update util.py
Browse files Browse the repository at this point in the history
  • Loading branch information
zhou9584 committed Dec 2, 2024
1 parent bece643 commit 2e3539d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion hercules/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def create_file(path, content):

def filter_functions(class_name, functions):
ret = functions
ret = [s for s in ret if re.match(r"public\s+\w+\s+\w+\((\w+\s*\w+\s*,\s*)*\w+\s*\w+\s*\)", s)]
ret = [s for s in ret if re.match(r"public\s+\w+\s+\w+\((\w+\s*\w+\s+,\s+)*\w+\s*\w+\s+\)", s)]

Check failure

Code scanning / CodeQL

Inefficient regular expression High

This part of the regular expression may cause exponential backtracking on strings starting with 'public a a(' and containing many repetitions of 'aaa , '.
ret = [s for s in ret if (class_name + "(") not in s]
return ret

Expand Down

0 comments on commit 2e3539d

Please sign in to comment.