Commit dba30652 authored by Thibaud Michaud's avatar Thibaud Michaud Committed by Commit Bot

[wasm][liftoff][eh] Fix access to empty try info

If the block is unreachable, the interface is not called and the
{try_info} field is not set. Therefore, check it before accessing it.

R=clemensb@chromium.org

Bug: chromium:1188975
Change-Id: Ic6d7d2b7e26b0448143076e25a89c036216e8618
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2767017Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73480}
parent 8abb3529
...@@ -568,7 +568,7 @@ class LiftoffCompiler { ...@@ -568,7 +568,7 @@ class LiftoffCompiler {
Control* c = decoder->control_at(i); Control* c = decoder->control_at(i);
Unuse(c->label.get()); Unuse(c->label.get());
if (c->else_state) Unuse(c->else_state->label.get()); if (c->else_state) Unuse(c->else_state->label.get());
if (c->is_try()) Unuse(&c->try_info->catch_label); if (c->try_info != nullptr) Unuse(&c->try_info->catch_label);
} }
for (auto& ool : out_of_line_code_) Unuse(ool.label.get()); for (auto& ool : out_of_line_code_) Unuse(ool.label.get());
#endif #endif
......
// Copyright 2021 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --experimental-wasm-eh
load("test/mjsunit/wasm/wasm-module-builder.js");
(function Regress1188975() {
print(arguments.callee.name);
let builder = new WasmModuleBuilder();
builder.addFunction("f", kSig_v_v)
.addBody([
kExprUnreachable,
kExprTry, kWasmStmt,
kExprElse,
kExprCatchAll,
kExprEnd,
]);
assertThrows(() => builder.instantiate(), WebAssembly.CompileError);
})();
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