diff options
author | Alon Zakai <azakai@google.com> | 2022-01-28 08:38:02 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-28 08:38:02 -0800 |
commit | 43844d4bf34646aab0a1d575ad815a42e37dfc08 (patch) | |
tree | b1fc0c59edc326ac394c967d0e2dac84ae7dc4f4 | |
parent | 2f2a2bfc78c0bbc21f08bfe6bd632d4278e764ae (diff) | |
download | binaryen-43844d4bf34646aab0a1d575ad815a42e37dfc08.tar.gz binaryen-43844d4bf34646aab0a1d575ad815a42e37dfc08.tar.bz2 binaryen-43844d4bf34646aab0a1d575ad815a42e37dfc08.zip |
Fuzzer: Fix a missing return of a trap (#4485)
We emitted the right text to stdout to indicate a trap in one code path, but did
not return a Trap from the function. As a result, we'd continue and hit the
assert on the next line.
-rw-r--r-- | src/tools/execution-results.h | 1 | ||||
-rw-r--r-- | test/lit/exec/non-nullable.wast | 14 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/tools/execution-results.h b/src/tools/execution-results.h index 94447ab4d..78972cfc9 100644 --- a/src/tools/execution-results.h +++ b/src/tools/execution-results.h @@ -250,6 +250,7 @@ struct ExecutionResults { if (!param.isDefaultable()) { std::cout << "[trap fuzzer can only send defaultable parameters to " "exports]\n"; + return Trap{}; } arguments.push_back(Literal::makeZero(param)); } diff --git a/test/lit/exec/non-nullable.wast b/test/lit/exec/non-nullable.wast new file mode 100644 index 000000000..d443947c6 --- /dev/null +++ b/test/lit/exec/non-nullable.wast @@ -0,0 +1,14 @@ +;; NOTE: Assertions have been generated by update_lit_checks.py --output=fuzz-exec and should not be edited. + +;; RUN: wasm-opt %s -all --fuzz-exec -q -o /dev/null 2>&1 | filecheck %s + +(module + ;; CHECK: [fuzz-exec] calling get-ref + ;; CHECK-NEXT: [trap fuzzer can only send defaultable parameters to exports] + (func "get-ref" (param $0 (ref any)) + (nop) + ) +) +;; CHECK: [fuzz-exec] calling get-ref +;; CHECK-NEXT: [trap fuzzer can only send defaultable parameters to exports] +;; CHECK-NEXT: [fuzz-exec] comparing get-ref |