Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions scripts/fuzz_opt.py
Original file line number Diff line number Diff line change
Expand Up @@ -1379,8 +1379,12 @@ class CtorEval(TestCaseHandler):
frequency = 0.1

def handle(self, wasm):
# get the list of func exports, so we can tell ctor-eval what to eval.
# Get the list of func exports, so we can tell ctor-eval what to eval.
func_exports = get_exports(wasm, ['func'])
# Avoid names that need escaping. Just allow simple names like func_256,
# which the fuzzer emits
# TODO: fix escaping in the tool and here
func_exports = [export for export in func_exports if re.fullmatch(r'^\w+$', export)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to look up \w, and it's not clear that "Unicode word characters" is exactly the class we want. Let's be more explicit and use [a-zA-Z0-9_] instead.

ctors = ','.join(func_exports)
if not ctors:
return
Expand All @@ -1397,11 +1401,6 @@ def handle(self, wasm):
# get the expected execution results.
wasm_exec = run_bynterp(wasm, ['--fuzz-exec-before'])

# Fix escaping of the names, as we will be passing them as commandline
# parameters below (e.g. we want --ctors=foo\28bar and not
# --ctors=foo\\28bar; that extra escaping \ would cause an error).
ctors = ctors.replace('\\\\', '\\')

# eval the wasm.
# we can use --ignore-external-input because the fuzzer passes in 0 to
# all params, which is the same as ctor-eval assumes in this mode.
Expand Down
Loading