-
Notifications
You must be signed in to change notification settings - Fork 309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Erikcorry/multi sandbox #3102
base: main
Are you sure you want to change the base?
Erikcorry/multi sandbox #3102
Conversation
} else { | ||
auto result = BackingStore(v8::ArrayBuffer::NewBackingStore(js.v8Isolate, size), size, 0, | ||
getBufferSourceElementSize<T>(), construct<T>, checkIsIntegerType<T>()); | ||
memcpy(result.asArrayPtr().begin(), data.begin(), size); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use result.AsArrayPtr().copyFrom(...)
here instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, using jsg::BackingStore::alloc<T>(js, N)
would be easier here?
// Creates a new BackingStore that takes over ownership of the given kj::Array. | ||
// The bytes may be moved if they are not inside the sandbox already. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// The bytes may be moved if they are not inside the sandbox already. | |
// The bytes may be copied if they are not inside the sandbox already. |
size_t size = value.size(); | ||
if (size == 0) { | ||
// BackingStore doesn't call custom deleter if begin is null, which it often is for empty | ||
// arrays. | ||
return v8::ArrayBuffer::New(isolate, 0); | ||
} | ||
byte* begin = value.begin(); | ||
if (isolate->GetGroup().SandboxContains(begin)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps this could be extracted into a separate utility since there are two places doing this same check and operation?
1ca82ac
to
7a1716d
Compare
No description provided.