File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -1545,6 +1545,9 @@ Result<> IRBuilder::makeThrowRef() {
15451545}
15461546
15471547Result<> IRBuilder::makeTupleMake (uint32_t arity) {
1548+ if (arity < 2 ) {
1549+ return Err{" tuple arity must be at least 2" };
1550+ }
15481551 TupleMake curr (wasm.allocator );
15491552 curr.operands .resize (arity);
15501553 CHECK_ERR (visitTupleMake (&curr));
@@ -1553,13 +1556,22 @@ Result<> IRBuilder::makeTupleMake(uint32_t arity) {
15531556}
15541557
15551558Result<> IRBuilder::makeTupleExtract (uint32_t arity, uint32_t index) {
1559+ if (index >= arity) {
1560+ return Err{" tuple index out of bounds" };
1561+ }
1562+ if (arity < 2 ) {
1563+ return Err{" tuple arity must be at least 2" };
1564+ }
15561565 TupleExtract curr;
15571566 CHECK_ERR (visitTupleExtract (&curr, arity));
15581567 push (builder.makeTupleExtract (curr.tuple , index));
15591568 return Ok{};
15601569}
15611570
15621571Result<> IRBuilder::makeTupleDrop (uint32_t arity) {
1572+ if (arity < 2 ) {
1573+ return Err{" tuple arity must be at least 2" };
1574+ }
15631575 Drop curr;
15641576 CHECK_ERR (visitDrop (&curr, arity));
15651577 push (builder.makeDrop (curr.value ));
You can’t perform that action at this time.
0 commit comments