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
14 changes: 13 additions & 1 deletion scripts/fuzz_opt.py
Original file line number Diff line number Diff line change
Expand Up @@ -2219,6 +2219,11 @@ def do_handle_pair(self, input, before_wasm, after_wasm, opts):
def do_run(self, vm, js, wasm):
out = vm.run_js(js, wasm, checked=False)

# VM crashes are actual issues we want to find.
if '(core dumped)' in out or 'Received signal' in out or '== C stack trace ==' in out or '== JS stack trace ==' in out:
raise Exception(f"VM crash:\n\n{out}")
Comment on lines +2222 to +2224
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why is this different than in other fuzz handlers?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Our normal JS is very careful to swallow and log any JS errors. The return code of the process is always 0.

Here we are running JS that is itself a fuzz testcase, and might error.


# Clean up stack traces.
cleaned = []
for line in out.splitlines():
if 'RuntimeError:' in line or 'TypeError:' in line:
Expand All @@ -2240,7 +2245,14 @@ def do_run(self, vm, js, wasm):
# Ignore it, as details of traces differ based on optimizations.
continue
cleaned.append(line)
return '\n'.join(cleaned)
cleaned = '\n'.join(cleaned)

# Clean up function references, which can differ after opts, things like
#
# function 77() { [native code] }
#
cleaned = re.sub(r'function \d+\(\) ', 'function <ID>() ', cleaned)
return cleaned

def can_run_on_wasm(self, wasm):
return all_disallowed(DISALLOWED_FEATURES_IN_V8)
Expand Down
Loading