Skip to content

Commit 7113c49

Browse files
authored
[NFC] CtorEval fuzzing: skip export names that may need escaping (WebAssembly#8502)
Fuzzing them is not that important for now. Fixes WebAssembly#8482
1 parent 2165afc commit 7113c49

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

scripts/fuzz_opt.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1379,8 +1379,12 @@ class CtorEval(TestCaseHandler):
13791379
frequency = 0.1
13801380

13811381
def handle(self, wasm):
1382-
# get the list of func exports, so we can tell ctor-eval what to eval.
1382+
# Get the list of func exports, so we can tell ctor-eval what to eval.
13831383
func_exports = get_exports(wasm, ['func'])
1384+
# Avoid names that need escaping. Just allow simple names like func_256,
1385+
# which the fuzzer emits
1386+
# TODO: fix escaping in the tool and here
1387+
func_exports = [export for export in func_exports if re.fullmatch(r'^[0-9a-zA-Z_]+$', export)]
13841388
ctors = ','.join(func_exports)
13851389
if not ctors:
13861390
return
@@ -1397,11 +1401,6 @@ def handle(self, wasm):
13971401
# get the expected execution results.
13981402
wasm_exec = run_bynterp(wasm, ['--fuzz-exec-before'])
13991403

1400-
# Fix escaping of the names, as we will be passing them as commandline
1401-
# parameters below (e.g. we want --ctors=foo\28bar and not
1402-
# --ctors=foo\\28bar; that extra escaping \ would cause an error).
1403-
ctors = ctors.replace('\\\\', '\\')
1404-
14051404
# eval the wasm.
14061405
# we can use --ignore-external-input because the fuzzer passes in 0 to
14071406
# all params, which is the same as ctor-eval assumes in this mode.

0 commit comments

Comments
 (0)