summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2024-06-24 12:17:11 -0700
committerGitHub <noreply@github.com>2024-06-24 12:17:11 -0700
commited35193eef158d4685a88ed00d742d969d366c64 (patch)
treec2bbdb75900aa4710776a803c836c1c5da653392 /src
parenta27d952a4be7399ed30c53fcf035caacb54b7c84 (diff)
downloadbinaryen-ed35193eef158d4685a88ed00d742d969d366c64.tar.gz
binaryen-ed35193eef158d4685a88ed00d742d969d366c64.tar.bz2
binaryen-ed35193eef158d4685a88ed00d742d969d366c64.zip
Add a proper error for bad select results (#6697)
The result cannot be `none` or `unreachable` etc. Fixes #6694
Diffstat (limited to 'src')
-rw-r--r--src/wasm/wasm-binary.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp
index dc97dbbc3..b76a789de 100644
--- a/src/wasm/wasm-binary.cpp
+++ b/src/wasm/wasm-binary.cpp
@@ -6865,7 +6865,11 @@ void WasmBinaryReader::visitSelect(Select* curr, uint8_t code) {
size_t numTypes = getU32LEB();
std::vector<Type> types;
for (size_t i = 0; i < numTypes; i++) {
- types.push_back(getType());
+ auto t = getType();
+ if (!t.isConcrete()) {
+ throwError("bad select type");
+ }
+ types.push_back(t);
}
curr->type = Type(types);
}