summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-validator.cpp
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2017-07-18 09:17:57 -0700
committerGitHub <noreply@github.com>2017-07-18 09:17:57 -0700
commite865f2fa2863b6e91521c059a61a4483769bf5c9 (patch)
treef2d4bbee701376a4975ebf0d2c518f10369fdabd /src/wasm/wasm-validator.cpp
parent24accd15fb59d476daaebbbcd492b8a9ee729b2b (diff)
parent7bc2ed70de137aa6615fcd5d0e1f3e88f008a738 (diff)
downloadbinaryen-e865f2fa2863b6e91521c059a61a4483769bf5c9.tar.gz
binaryen-e865f2fa2863b6e91521c059a61a4483769bf5c9.tar.bz2
binaryen-e865f2fa2863b6e91521c059a61a4483769bf5c9.zip
Merge pull request #1095 from WebAssembly/fuzz-3
More fuzz fixes
Diffstat (limited to 'src/wasm/wasm-validator.cpp')
-rw-r--r--src/wasm/wasm-validator.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp
index 1b328ec19..5ca6b2783 100644
--- a/src/wasm/wasm-validator.cpp
+++ b/src/wasm/wasm-validator.cpp
@@ -261,14 +261,17 @@ void WasmValidator::visitAtomicCmpxchg(AtomicCmpxchg* curr) {
shouldBeEqualOrFirstIsUnreachable(curr->replacement->type, curr->type, curr, "Cmpxchg result type must match replacement");
shouldBeIntOrUnreachable(curr->expected->type, curr, "Atomic operations are only valid on int types");
}
-void WasmValidator::validateMemBytes(uint8_t bytes, WasmType ty, Expression* curr) {
+void WasmValidator::validateMemBytes(uint8_t bytes, WasmType type, Expression* curr) {
+ if (type == unreachable) {
+ return; // nothing to validate in this case
+ }
switch (bytes) {
case 1:
case 2:
case 4:
break;
case 8: {
- shouldBeEqual(getWasmTypeSize(ty), 8U, curr, "8-byte mem operations are only allowed with 8-byte wasm types");
+ shouldBeEqual(getWasmTypeSize(type), 8U, curr, "8-byte mem operations are only allowed with 8-byte wasm types");
break;
}
default: fail("Memory operations must be 1,2,4, or 8 bytes", curr);