Commit 04441c44 authored by Thibaud Michaud's avatar Thibaud Michaud Committed by Commit Bot

[wasm][eh] Misc fixes found by local fuzzing

- Add missing EnsureStackSpace before unpacking the exception (decoder)
- Pop current catch when delegating to the caller (graph builder)
- Mark throw opcode as unconditional jump

R=clemensb@chromium.org

Bug: v8:8091, v8:11449
Change-Id: I702f6a99581476e77d254e2ea91f9c463ceed444
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2692688
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72737}
parent 987a7f4a
......@@ -2525,6 +2525,7 @@ class WasmFullDecoder : public WasmDecoder<validate> {
stack_end_ = stack_ + c->stack_depth;
c->reachability = control_at(1)->innerReachability();
const WasmExceptionSig* sig = imm.exception->sig;
EnsureStackSpace(static_cast<int>(sig->parameter_count()));
for (size_t i = 0, e = sig->parameter_count(); i < e; ++i) {
Push(sig->GetParam(i));
}
......
......@@ -768,6 +768,7 @@ class WasmGraphBuildingInterface {
if (depth == decoder->control_depth() - 1) {
builder_->Rethrow(block->try_info->exception);
builder_->TerminateThrow(effect(), control());
current_catch_ = block->previous_catch;
return;
}
DCHECK(decoder->control_at(depth)->is_try());
......@@ -1102,6 +1103,7 @@ class WasmGraphBuildingInterface {
TFNode* control() { return builder_->control(); }
TryInfo* current_try_info(FullDecoder* decoder) {
DCHECK_LT(current_catch_, decoder->control_depth());
return decoder->control_at(decoder->control_depth() - 1 - current_catch_)
->try_info;
}
......
......@@ -504,6 +504,8 @@ constexpr bool WasmOpcodes::IsUnconditionalJump(WasmOpcode opcode) {
case kExprReturn:
case kExprReturnCall:
case kExprReturnCallIndirect:
case kExprThrow:
case kExprRethrow:
return true;
default:
return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment