diff options
author | Alon Zakai <alonzakai@gmail.com> | 2015-11-04 18:07:09 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2015-11-04 18:07:09 -0800 |
commit | f36058e50d0aadcdeeb68716e69af83c75a51cff (patch) | |
tree | 9b867391a4cc60294addfbef979c5acd04efa69e /src/wasm-shell.cpp | |
parent | 4a464bbd20dda5f67adc8721b7cc3df6f0f0f06f (diff) | |
download | binaryen-f36058e50d0aadcdeeb68716e69af83c75a51cff.tar.gz binaryen-f36058e50d0aadcdeeb68716e69af83c75a51cff.tar.bz2 binaryen-f36058e50d0aadcdeeb68716e69af83c75a51cff.zip |
fix load/store traps
Diffstat (limited to 'src/wasm-shell.cpp')
-rw-r--r-- | src/wasm-shell.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/wasm-shell.cpp b/src/wasm-shell.cpp index 4d2d3b560..4d16a8d3b 100644 --- a/src/wasm-shell.cpp +++ b/src/wasm-shell.cpp @@ -58,7 +58,7 @@ struct ShellExternalInterface : ModuleInstance::ExternalInterface { size_t addr = ptr.geti32(); int64_t full = addr; full += load->offset; - if (full + load->bytes >= memorySize) trap(); + if (full + load->bytes > memorySize) trap(); addr = full; switch (load->type) { case i32: { @@ -81,7 +81,7 @@ struct ShellExternalInterface : ModuleInstance::ExternalInterface { size_t addr = ptr.geti32(); int64_t full = addr; full += store->offset; - if (full + store->bytes >= memorySize) trap(); + if (full + store->bytes > memorySize) trap(); switch (store->type) { case i32: { switch (store->bytes) { @@ -146,6 +146,7 @@ int main(int argc, char **argv) { Element& curr = *root[i]; IString id = curr[0]->str(); if (id == MODULE) break; + std::cerr << curr << '\n'; Element& invoke = *curr[1]; assert(invoke[0]->str() == INVOKE); IString name = invoke[1]->str(); |