summaryrefslogtreecommitdiff
path: root/src/wasm-interpreter.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm-interpreter.h')
-rw-r--r--src/wasm-interpreter.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h
index 392b0c2bc..243542836 100644
--- a/src/wasm-interpreter.h
+++ b/src/wasm-interpreter.h
@@ -1433,11 +1433,19 @@ public:
return cast;
}
cast.originalRef = ref.getSingleValue();
- auto gcData = cast.originalRef.getGCData();
- if (!gcData) {
+ if (cast.originalRef.isNull()) {
cast.outcome = cast.Null;
return cast;
}
+ // The input may not be a struct or an array; for example it could be an
+ // anyref of null (already handled above) or anything else (handled here,
+ // but this is for future use as atm the binaryen interpreter cannot
+ // represent external references).
+ if (!cast.originalRef.isGCData()) {
+ cast.outcome = cast.Failure;
+ return cast;
+ }
+ auto gcData = cast.originalRef.getGCData();
auto refRtt = gcData->rtt;
auto intendedRtt = rtt.getSingleValue();
if (!refRtt.isSubRtt(intendedRtt)) {