Commit 26230971 authored by Thibaud Michaud's avatar Thibaud Michaud Committed by V8 LUCI CQ

[wasm][eh] Handle exceptions during value encoding

Handle the case where getting a value in the iterable object that
encodes the values throws an exception.

R=ahaas@chromium.org

Bug: chromium:1347073
Change-Id: Ie660ab04148d5fd3508397ae6e08130496f61b74
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3788097
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81974}
parent 42af5dcd
...@@ -1754,6 +1754,8 @@ void EncodeExceptionValues(v8::Isolate* isolate, ...@@ -1754,6 +1754,8 @@ void EncodeExceptionValues(v8::Isolate* isolate,
auto values = arg.As<Object>(); auto values = arg.As<Object>();
for (int i = 0; i < signature->length(); ++i) { for (int i = 0; i < signature->length(); ++i) {
MaybeLocal<Value> maybe_value = values->Get(context, i); MaybeLocal<Value> maybe_value = values->Get(context, i);
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
if (i_isolate->has_scheduled_exception()) return;
Local<Value> value = maybe_value.ToLocalChecked(); Local<Value> value = maybe_value.ToLocalChecked();
i::wasm::ValueType type = signature->get(i); i::wasm::ValueType type = signature->get(i);
switch (type.kind()) { switch (type.kind()) {
......
// Copyright 2022 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.
var values = [];
Object.prototype.__defineGetter__(0, function() {
throw new Error('foo');
});
let tag = new WebAssembly.Tag({parameters: ['externref']});
assertThrows(() => new WebAssembly.Exception(tag, values), Error, 'foo');
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