summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/wasm-interpreter.h5
-rw-r--r--src/wasm-shell.cpp2
2 files changed, 4 insertions, 3 deletions
diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h
index 55eb2e269..586715b77 100644
--- a/src/wasm-interpreter.h
+++ b/src/wasm-interpreter.h
@@ -380,8 +380,9 @@ public:
if (val > (double)UINT_MAX || val <= (double)-1) instance.externalInterface->trap();
return Flow(Literal(uint32_t(val)));
} else {
- if (val > (double)ULLONG_MAX || val <= (double)-1) instance.externalInterface->trap();
- return Flow(Literal(uint64_t(val)));
+ uint64_t converted = val;
+ if (converted < val - 1 || val <= (double)-1) instance.externalInterface->trap();
+ return Flow(Literal(converted));
}
}
case ReinterpretFloat: return curr->type == i32 ? Flow(Literal(value.reinterpreti32())) : Flow(Literal(value.reinterpreti64()));
diff --git a/src/wasm-shell.cpp b/src/wasm-shell.cpp
index 6761e46d8..bafbf75dc 100644
--- a/src/wasm-shell.cpp
+++ b/src/wasm-shell.cpp
@@ -146,7 +146,7 @@ int main(int argc, char **argv) {
Element& curr = *root[i];
IString id = curr[0]->str();
if (id == MODULE) break;
- std::cerr << "CHECKING| " << curr << '\n';
+ std::cerr << i << '/' << root.size() << " CHECKING| " << curr << '\n';
Element& invoke = *curr[1];
assert(invoke[0]->str() == INVOKE);
IString name = invoke[1]->str();