Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/wasm/wasm-ir-builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1412,6 +1412,9 @@ Result<> IRBuilder::makeLocalGet(Index local) {
if (!func) {
return Err{"local.get is only valid in a function context"};
}
if (local >= func->getNumLocals()) {
return Err{"invalid local.get index"};
}
push(builder.makeLocalGet(local, func->getLocalType(local)));
return Ok{};
}
Expand All @@ -1420,6 +1423,9 @@ Result<> IRBuilder::makeLocalSet(Index local) {
if (!func) {
return Err{"local.set is only valid in a function context"};
}
if (local >= func->getNumLocals()) {
return Err{"invalid local.set index"};
}
LocalSet curr;
curr.index = local;
CHECK_ERR(visitLocalSet(&curr));
Expand All @@ -1431,6 +1437,9 @@ Result<> IRBuilder::makeLocalTee(Index local) {
if (!func) {
return Err{"local.tee is only valid in a function context"};
}
if (local >= func->getNumLocals()) {
return Err{"invalid local.tee index"};
}
LocalSet curr;
curr.index = local;
CHECK_ERR(visitLocalSet(&curr));
Expand Down
Loading