Skip to content

Commit 90f7a5c

Browse files
thangktranBridgeAR
authored andcommitted
src: set arraybuffer_untransferable_private_symbol
for `ArrayBuffer` whose buffers are not own by `BackingStore`. This would help us avoid problem with the new V8 BackingStore API where new `ArrayBuffer` is allocated at the same place of previous `ArrayBuffer` that is still being tracked in `BackingStore` table. PR-URL: #31053 Refs: #31052 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent 643241a commit 90f7a5c

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/node_buffer.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,6 +1213,10 @@ void Initialize(Local<Object> target,
12131213
// TODO(thangktran): drop this check when V8 is pumped to 8.0 .
12141214
if (!array_buffer->IsExternal())
12151215
array_buffer->Externalize(array_buffer->GetBackingStore());
1216+
array_buffer->SetPrivate(
1217+
env->context(),
1218+
env->arraybuffer_untransferable_private_symbol(),
1219+
True(env->isolate())).Check();
12161220
CHECK(target
12171221
->Set(env->context(),
12181222
FIXED_ONE_BYTE_STRING(env->isolate(), "zeroFill"),

src/node_http2.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,9 @@ Http2Session::Http2Session(Environment* env,
578578
// TODO(thangktran): drop this check when V8 is pumped to 8.0 .
579579
if (!ab->IsExternal())
580580
ab->Externalize(ab->GetBackingStore());
581+
ab->SetPrivate(env->context(),
582+
env->arraybuffer_untransferable_private_symbol(),
583+
True(env->isolate())).Check();
581584
js_fields_ab_.Reset(env->isolate(), ab);
582585
Local<Uint8Array> uint8_arr =
583586
Uint8Array::New(ab, 0, kSessionUint8FieldCount);

0 commit comments

Comments
 (0)