mirror of
https://github.com/nodejs/node.git
synced 2026-11-25 23:01:06 -05:00
deps: V8: cherry-pick 81814ed44574
Original commit message:
[promise] Avoid stack overflow with context promise hooks in C++
This was handled in JS but not in C++.
Bug: chromium:236703, v8:11025
Change-Id: Ic9adc4ceb4d2af2614427fec459c3e950654572f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3074460
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#76125}
Refs: https://github.com/v8/v8/commit/81814ed44574dbdb19ad22857220ac81fba5c107
PR-URL: https://github.com/nodejs/node/pull/39719
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit is contained in:
1 parent
7e9884598f
commit
103bf20988
2 files changed
+17
-1
No files matched your search
Vendored
+9
-1
@@ -547,7 +547,15 @@ void NativeContext::RunPromiseHook(PromiseHookType type,
|
||||
|
||||
Handle<Object> receiver = isolate->global_proxy();
|
||||
|
||||
if (Execution::Call(isolate, hook, receiver, argc, argv).is_null()) {
|
||||
StackLimitCheck check(isolate);
|
||||
bool failed = false;
|
||||
if (check.HasOverflowed()) {
|
||||
isolate->StackOverflow();
|
||||
failed = true;
|
||||
} else {
|
||||
failed = Execution::Call(isolate, hook, receiver, argc, argv).is_null();
|
||||
}
|
||||
if (failed) {
|
||||
DCHECK(isolate->has_pending_exception());
|
||||
Handle<Object> exception(isolate->pending_exception(), isolate);
|
||||
|
||||
|
||||
+8
@@ -273,3 +273,11 @@ exceptions();
|
||||
|
||||
d8.promise.setHooks();
|
||||
})();
|
||||
|
||||
(function overflow(){
|
||||
d8.promise.setHooks(() => { new Promise(()=>{}) });
|
||||
// Trigger overflow from JS code:
|
||||
Promise.all([Promise.resolve(1)]);
|
||||
%PerformMicrotaskCheckpoint();
|
||||
d8.promise.setHooks();
|
||||
});
|
||||
Reference in new issue
Block a user