Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

Commit 6418b51

Browse files
addaleaxdeepak1556
authored andcommitted
worker: copy transferList ArrayBuffers on unknown allocator
If the `ArrayBuffer::Allocator` used to create `ArrayBuffer`s in the current `Isolate` is not a Node.js `ArrayBufferAllocator`, we cannot know that it is `malloc()`-based, an in particular it might not be compatible with the `ArrayBuffer::Allocator` on the receiving end of the connection. PR-URL: nodejs/node#26207 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Joyee Cheung <[email protected]>
1 parent 5538126 commit 6418b51

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/node_messaging.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,8 @@ Maybe<bool> Message::Serialize(Environment* env,
279279
Local<ArrayBuffer> ab = entry.As<ArrayBuffer>();
280280
// If we cannot render the ArrayBuffer unusable in this Isolate and
281281
// take ownership of its memory, copying the buffer will have to do.
282-
if (!ab->IsNeuterable() || ab->IsExternal())
282+
if (!ab->IsNeuterable() || ab->IsExternal() ||
283+
!env->isolate_data()->uses_node_allocator()) {
283284
continue;
284285
}
285286
// We simply use the array index in the `array_buffers` list as the

0 commit comments

Comments
 (0)