Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6bc7a6d

Browse filesBrowse files
Gabriel Schulhoftargos
authored andcommitted
deps: V8: cherry-pick e5dbc95
Original commit message: [api] Fix handle leak when getting Context embedder data The `Context::SlowGetAlignedPointerFromEmbedderData()` method returns a pointer, so the fact that it allocates handles is not obvious to the caller. Since this is the slow path anyway, simply add a handle scope inside of it. The tests are also modified to perform the same check for the `Object` equivalent of this method. Change-Id: I5f03c9a7b70b3a17315609df021606a53c9feb2d Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1879902 Reviewed-by: Yang Guo <yangguo@chromium.org> Commit-Queue: Yang Guo <yangguo@chromium.org> Cr-Commit-Position: refs/heads/master@{#64583} Refs: v8/v8@e5dbc95 Fixes: #30127 PR-URL: #30130 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michaël Zasso <targos@protonmail.com>
1 parent c5d312f commit 6bc7a6d
Copy full SHA for 6bc7a6d

File tree

Expand file treeCollapse file tree

3 files changed

+8
-3
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+8
-3
lines changed
Open diff view settings
Collapse file

‎common.gypi‎

Copy file name to clipboardExpand all lines: common.gypi
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
# Reset this number to 0 on major V8 upgrades.
4040
# Increment by one for each non-official patch applied to deps/v8.
41-
'v8_embedder_string': '-node.14',
41+
'v8_embedder_string': '-node.15',
4242

4343
##### V8 defaults for Node.js #####
4444

Collapse file

‎deps/v8/src/api/api.cc‎

Copy file name to clipboardExpand all lines: deps/v8/src/api/api.cc
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,6 +1281,7 @@ void Context::SetEmbedderData(int index, v8::Local<Value> value) {
12811281

12821282
void* Context::SlowGetAlignedPointerFromEmbedderData(int index) {
12831283
const char* location = "v8::Context::GetAlignedPointerFromEmbedderData()";
1284+
HandleScope handle_scope(GetIsolate());
12841285
i::Handle<i::EmbedderDataArray> data =
12851286
EmbedderDataFor(this, index, false, location);
12861287
if (data.is_null()) return nullptr;
Collapse file

‎deps/v8/test/cctest/test-api.cc‎

Copy file name to clipboardExpand all lines: deps/v8/test/cctest/test-api.cc
+6-2Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2955,8 +2955,11 @@ THREADED_TEST(SetAlignedPointerInInternalFields) {
29552955

29562956
obj->SetAlignedPointerInInternalFields(2, indices, values);
29572957
CcTest::CollectAllGarbage();
2958-
CHECK_EQ(heap_allocated_1, obj->GetAlignedPointerFromInternalField(0));
2959-
CHECK_EQ(heap_allocated_2, obj->GetAlignedPointerFromInternalField(1));
2958+
{
2959+
v8::SealHandleScope no_handle_leak(isolate);
2960+
CHECK_EQ(heap_allocated_1, obj->GetAlignedPointerFromInternalField(0));
2961+
CHECK_EQ(heap_allocated_2, obj->GetAlignedPointerFromInternalField(1));
2962+
}
29602963

29612964
indices[0] = 1;
29622965
indices[1] = 0;
@@ -3009,6 +3012,7 @@ THREADED_TEST(EmbedderDataAlignedPointers) {
30093012
}
30103013
CcTest::CollectAllGarbage();
30113014
for (int i = 0; i < 100; i++) {
3015+
v8::SealHandleScope no_handle_leak(env->GetIsolate());
30123016
CHECK_EQ(AlignedTestPointer(i), env->GetAlignedPointerFromEmbedderData(i));
30133017
}
30143018
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.