File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -1412,6 +1412,9 @@ Result<> IRBuilder::makeLocalGet(Index local) {
14121412 if (!func) {
14131413 return Err{" local.get is only valid in a function context" };
14141414 }
1415+ if (local >= func->getNumLocals ()) {
1416+ return Err{" invalid local.get index" };
1417+ }
14151418 push (builder.makeLocalGet (local, func->getLocalType (local)));
14161419 return Ok{};
14171420}
@@ -1420,6 +1423,9 @@ Result<> IRBuilder::makeLocalSet(Index local) {
14201423 if (!func) {
14211424 return Err{" local.set is only valid in a function context" };
14221425 }
1426+ if (local >= func->getNumLocals ()) {
1427+ return Err{" invalid local.set index" };
1428+ }
14231429 LocalSet curr;
14241430 curr.index = local;
14251431 CHECK_ERR (visitLocalSet (&curr));
@@ -1431,6 +1437,9 @@ Result<> IRBuilder::makeLocalTee(Index local) {
14311437 if (!func) {
14321438 return Err{" local.tee is only valid in a function context" };
14331439 }
1440+ if (local >= func->getNumLocals ()) {
1441+ return Err{" invalid local.tee index" };
1442+ }
14341443 LocalSet curr;
14351444 curr.index = local;
14361445 CHECK_ERR (visitLocalSet (&curr));
You can’t perform that action at this time.
0 commit comments