From bee4451ed81cac290bc0c46b4f6d376e81ea317a Mon Sep 17 00:00:00 2001 From: Gus Caplan Date: Wed, 2 Feb 2022 09:54:37 -0600 Subject: [PATCH] deps: V8: cherry-pick cc9a8a37445e MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Original commit message: fix overflow check in error formatting Bug: v8:12494 Change-Id: Iba2684173296aa236f1a1c73a5606c21472eff06 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3426634 Reviewed-by: Jakob Kummerow Commit-Queue: Gus Caplan Cr-Commit-Position: refs/heads/main@{#78909} Refs: https://github.com/v8/v8/commit/cc9a8a37445eeffff17474020bb6038c2f9af9fc PR-URL: https://github.com/nodejs/node/pull/41823 Reviewed-By: Mohammed Keyvanzadeh Reviewed-By: Colin Ihrig Reviewed-By: Michaƫl Zasso Reviewed-By: Richard Lau Reviewed-By: Mary Marchini Reviewed-By: Benjamin Gruenbaum --- deps/v8/src/execution/messages.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/deps/v8/src/execution/messages.cc b/deps/v8/src/execution/messages.cc index 10d89ca14e8106..e6bb088ac0f777 100644 --- a/deps/v8/src/execution/messages.cc +++ b/deps/v8/src/execution/messages.cc @@ -306,7 +306,8 @@ MaybeHandle ErrorUtils::FormatStackTrace(Isolate* isolate, const bool in_recursion = isolate->formatting_stack_trace(); const bool has_overflowed = i::StackLimitCheck{isolate}.HasOverflowed(); Handle error_context; - if (!in_recursion && error->GetCreationContext().ToHandle(&error_context)) { + if (!in_recursion && !has_overflowed && + error->GetCreationContext().ToHandle(&error_context)) { DCHECK(error_context->IsNativeContext()); if (isolate->HasPrepareStackTraceCallback()) { @@ -322,7 +323,7 @@ MaybeHandle ErrorUtils::FormatStackTrace(Isolate* isolate, isolate->RunPrepareStackTraceCallback(error_context, error, sites), Object); return result; - } else if (!has_overflowed) { + } else { Handle global_error = handle(error_context->error_function(), isolate);