Skip to content

Commit

Permalink
Merge pull request #398 from wasmx/stack-assert
Browse files Browse the repository at this point in the history
Add assertion that at most 1 stack element is returned in execute
  • Loading branch information
axic authored Jul 14, 2020
2 parents 9ad07fa + d4c795a commit 772fd56
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/fizzy/execute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1456,7 +1456,8 @@ execution_result execute(Instance& instance, FuncIdx func_idx, span<const uint64
}

end:
assert(pc == &code.instructions[code.instructions.size()] || trap);
// WebAssembly 1.0 allows at most one return variable.
assert(trap || (pc == &code.instructions[code.instructions.size()] && stack.size() <= 1));
return {trap, {stack.rbegin(), stack.rend()}};
}

Expand Down

0 comments on commit 772fd56

Please sign in to comment.