Skip to content
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

Ensure that crypto allocations are using BufferSource #3127

Merged
merged 1 commit into from
Nov 19, 2024

Conversation

jasnell
Copy link
Member

@jasnell jasnell commented Nov 15, 2024

... ensures that all ArrayBuffer instances are using BufferSource rather than external allocations.

@jasnell
Copy link
Member Author

jasnell commented Nov 15, 2024

A handful of the remaining uses of kj::heapArray could actually be converted to KJ_STACK_ARRAY but will handle that cleanup in a separate PR.

@jasnell jasnell force-pushed the jsnell/crypto-allocations-using-buffersource branch from 107ae02 to 825d12d Compare November 15, 2024 22:52
@jasnell jasnell force-pushed the jsnell/crypto-allocations-using-buffersource branch from 825d12d to fd2ebad Compare November 18, 2024 23:59
Copy link
Contributor

@erikcorry erikcorry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great, should help with the sandboxing of V8.

@@ -207,19 +207,28 @@ class CryptoKey: public jsg::Object {
KJ_SWITCH_ONEOF(publicExponent) {
KJ_CASE_ONEOF(array, BigInteger) {
if (fixPublicExp) {
auto expCopy = kj::heapArray<kj::byte>(array.asPtr());
jsg::BackingStore expBack = jsg::BackingStore::from(kj::mv(expCopy));
// alloc will, by default create a Uint8Array
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the comment is intended to document what type is hiding behind auto then would it not be nicer to just write the type there.

If that's not what is intended, then the reason for the comment is unclear.

src/workerd/api/crypto/crypto.c++ Show resolved Hide resolved
... ensures that all ArrayBuffer instances are using sandboxed allocations
rather than external allocations.
@jasnell jasnell force-pushed the jsnell/crypto-allocations-using-buffersource branch from fd2ebad to 8ce6016 Compare November 19, 2024 18:45
@jasnell jasnell merged commit f072094 into main Nov 19, 2024
14 checks passed
@jasnell jasnell deleted the jsnell/crypto-allocations-using-buffersource branch November 19, 2024 19:34
Pjrich1313

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants