diff options
author | Alon Zakai <azakai@google.com> | 2022-02-03 10:18:14 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-03 10:18:14 -0800 |
commit | 13a9d521bce7780032b33c51725876e69f297bde (patch) | |
tree | 61a8b1f9d53be7d8635f108debb2cc51ea0abbc4 /src/wasm/wasm-validator.cpp | |
parent | c0d98b51d3f4088f98f6bd09bd2921ffa9b6d344 (diff) | |
download | binaryen-13a9d521bce7780032b33c51725876e69f297bde.tar.gz binaryen-13a9d521bce7780032b33c51725876e69f297bde.tar.bz2 binaryen-13a9d521bce7780032b33c51725876e69f297bde.zip |
Fix an assertion in the validator on call_ref heaptypes (#4496)
We can only call getHeapType if it is indeed a function type. Otherwise we should
show the error and move on.
Diffstat (limited to 'src/wasm/wasm-validator.cpp')
-rw-r--r-- | src/wasm/wasm-validator.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp index 1ad1380c9..65fcc7a9d 100644 --- a/src/wasm/wasm-validator.cpp +++ b/src/wasm/wasm-validator.cpp @@ -2324,10 +2324,11 @@ void FunctionValidator::visitCallRef(CallRef* curr) { curr, "call_ref requires typed-function-references to be enabled"); if (curr->target->type != Type::unreachable) { - shouldBeTrue(curr->target->type.isFunction(), - curr, - "call_ref target must be a function reference"); - validateCallParamsAndResult(curr, curr->target->type.getHeapType()); + if (shouldBeTrue(curr->target->type.isFunction(), + curr, + "call_ref target must be a function reference")) { + validateCallParamsAndResult(curr, curr->target->type.getHeapType()); + } } } |