Erikcorry/multi sandbox#3102
Draft
erikcorry wants to merge 3 commits into
Draft
Conversation
jasnell
reviewed
Nov 13, 2024
| } 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); |
Collaborator
There was a problem hiding this comment.
Use result.AsArrayPtr().copyFrom(...) here instead?
Collaborator
There was a problem hiding this comment.
Also, using jsg::BackingStore::alloc<T>(js, N) would be easier here?
jasnell
reviewed
Nov 13, 2024
| static BackingStore from(kj::Array<kj::byte> data) { | ||
| static BackingStore from(Lock& js, kj::Array<kj::byte> data) { | ||
| // 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. |
Collaborator
There was a problem hiding this comment.
Suggested change
| // 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. |
jasnell
reviewed
Nov 13, 2024
| return v8::ArrayBuffer::New(isolate, 0); | ||
| } | ||
| byte* begin = value.begin(); | ||
| if (isolate->GetGroup().SandboxContains(begin)) { |
Collaborator
There was a problem hiding this comment.
Perhaps this could be extracted into a separate utility since there are two places doing this same check and operation?
1ca82ac to
7a1716d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.