src: remove usages of GetBackingStore in crypto#44079
Merged
nodejs-github-bot merged 2 commits intonodejs:mainfrom Aug 4, 2022
Merged
src: remove usages of GetBackingStore in crypto#44079nodejs-github-bot merged 2 commits intonodejs:mainfrom
nodejs-github-bot merged 2 commits intonodejs:mainfrom
Conversation
This removes all usages of GetBackingStore in `crypto`. See the linked issue for an explanation. Note: I am not sure of the lifetime semantics intended by `ArrayBufferOrViewContents` -- I am pretty sure it is correct based on a manual audit of the callsites, but please ensure that it is correct. Refs: nodejs#32226 Refs: nodejs#43921
Collaborator
|
Review requested:
|
F3n67u
approved these changes
Aug 1, 2022
Collaborator
addaleax
requested changes
Aug 1, 2022
addaleax
approved these changes
Aug 1, 2022
Collaborator
11 tasks
kvakil
added a commit
to kvakil/node
that referenced
this pull request
Aug 2, 2022
It is error-prone to copy or heap-allocate `ArrayBufferViewContents`, because you might accidentally cause it to exceed the lifetime of its argument. Let's make it impossible to do so. Fortunately we were not doing so anywhere already, so this diff is purely defensive. Refs: nodejs#44079 (comment)
Collaborator
tniessen
reviewed
Aug 2, 2022
| void operator=(const ArrayBufferOrViewContents&) = delete; | ||
|
|
||
| inline explicit ArrayBufferOrViewContents(v8::Local<v8::Value> buf) { | ||
| if (buf.IsEmpty()) { |
Member
There was a problem hiding this comment.
I understand why this exists, but it feels somewhat strange to explicitly allow passing in empty Locals.
Contributor
Author
There was a problem hiding this comment.
I agree. An alternative would be to allocate an empty ArrayBuffer and pass it into this function. None of the current callsites looked particularly hot, but I wasn't sure.
Do you think that would be acceptable wrt to performance?
(P.S. if your concern here is blocking, feel free to request changes on the PR.)
15 tasks
Collaborator
|
Landed in 4c725f4 |
This was referenced Aug 5, 2022
nodejs-github-bot
pushed a commit
that referenced
this pull request
Aug 6, 2022
It is error-prone to copy or heap-allocate `ArrayBufferViewContents`, because you might accidentally cause it to exceed the lifetime of its argument. Let's make it impossible to do so. Fortunately we were not doing so anywhere already, so this diff is purely defensive. Refs: #44079 (comment) PR-URL: #44091 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Feng Yu <F3n67u@outlook.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
danielleadams
pushed a commit
that referenced
this pull request
Aug 16, 2022
This removes all usages of GetBackingStore in `crypto`. See the linked issue for an explanation. Note: I am not sure of the lifetime semantics intended by `ArrayBufferOrViewContents` -- I am pretty sure it is correct based on a manual audit of the callsites, but please ensure that it is correct. Refs: #32226 Refs: #43921 PR-URL: #44079 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Feng Yu <F3n67u@outlook.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
danielleadams
pushed a commit
that referenced
this pull request
Aug 16, 2022
It is error-prone to copy or heap-allocate `ArrayBufferViewContents`, because you might accidentally cause it to exceed the lifetime of its argument. Let's make it impossible to do so. Fortunately we were not doing so anywhere already, so this diff is purely defensive. Refs: #44079 (comment) PR-URL: #44091 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Feng Yu <F3n67u@outlook.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
ruyadorno
pushed a commit
that referenced
this pull request
Aug 23, 2022
This removes all usages of GetBackingStore in `crypto`. See the linked issue for an explanation. Note: I am not sure of the lifetime semantics intended by `ArrayBufferOrViewContents` -- I am pretty sure it is correct based on a manual audit of the callsites, but please ensure that it is correct. Refs: #32226 Refs: #43921 PR-URL: #44079 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Feng Yu <F3n67u@outlook.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
ruyadorno
pushed a commit
that referenced
this pull request
Aug 23, 2022
It is error-prone to copy or heap-allocate `ArrayBufferViewContents`, because you might accidentally cause it to exceed the lifetime of its argument. Let's make it impossible to do so. Fortunately we were not doing so anywhere already, so this diff is purely defensive. Refs: #44079 (comment) PR-URL: #44091 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Feng Yu <F3n67u@outlook.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
targos
pushed a commit
that referenced
this pull request
Sep 5, 2022
It is error-prone to copy or heap-allocate `ArrayBufferViewContents`, because you might accidentally cause it to exceed the lifetime of its argument. Let's make it impossible to do so. Fortunately we were not doing so anywhere already, so this diff is purely defensive. Refs: #44079 (comment) PR-URL: #44091 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Feng Yu <F3n67u@outlook.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Fyko
pushed a commit
to Fyko/node
that referenced
this pull request
Sep 15, 2022
This removes all usages of GetBackingStore in `crypto`. See the linked issue for an explanation. Note: I am not sure of the lifetime semantics intended by `ArrayBufferOrViewContents` -- I am pretty sure it is correct based on a manual audit of the callsites, but please ensure that it is correct. Refs: nodejs#32226 Refs: nodejs#43921 PR-URL: nodejs#44079 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Feng Yu <F3n67u@outlook.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Fyko
pushed a commit
to Fyko/node
that referenced
this pull request
Sep 15, 2022
It is error-prone to copy or heap-allocate `ArrayBufferViewContents`, because you might accidentally cause it to exceed the lifetime of its argument. Let's make it impossible to do so. Fortunately we were not doing so anywhere already, so this diff is purely defensive. Refs: nodejs#44079 (comment) PR-URL: nodejs#44091 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Feng Yu <F3n67u@outlook.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
juanarbol
pushed a commit
that referenced
this pull request
Oct 10, 2022
It is error-prone to copy or heap-allocate `ArrayBufferViewContents`, because you might accidentally cause it to exceed the lifetime of its argument. Let's make it impossible to do so. Fortunately we were not doing so anywhere already, so this diff is purely defensive. Refs: #44079 (comment) PR-URL: #44091 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Feng Yu <F3n67u@outlook.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
juanarbol
pushed a commit
that referenced
this pull request
Oct 11, 2022
It is error-prone to copy or heap-allocate `ArrayBufferViewContents`, because you might accidentally cause it to exceed the lifetime of its argument. Let's make it impossible to do so. Fortunately we were not doing so anywhere already, so this diff is purely defensive. Refs: #44079 (comment) PR-URL: #44091 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Feng Yu <F3n67u@outlook.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
guangwong
pushed a commit
to noslate-project/node
that referenced
this pull request
Jan 3, 2023
It is error-prone to copy or heap-allocate `ArrayBufferViewContents`, because you might accidentally cause it to exceed the lifetime of its argument. Let's make it impossible to do so. Fortunately we were not doing so anywhere already, so this diff is purely defensive. Refs: nodejs/node#44079 (comment) PR-URL: nodejs/node#44091 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Feng Yu <F3n67u@outlook.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
guangwong
pushed a commit
to noslate-project/node
that referenced
this pull request
Jan 3, 2023
It is error-prone to copy or heap-allocate `ArrayBufferViewContents`, because you might accidentally cause it to exceed the lifetime of its argument. Let's make it impossible to do so. Fortunately we were not doing so anywhere already, so this diff is purely defensive. Refs: nodejs/node#44079 (comment) PR-URL: nodejs/node#44091 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Feng Yu <F3n67u@outlook.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
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.
This removes all usages of GetBackingStore in
crypto. See thelinked issue for an explanation.
Note: I am not sure of the lifetime semantics intended by
ArrayBufferOrViewContents-- I am pretty sure it is correct based on amanual audit of the callsites & by analogy to
ArrayBufferViewContents,but please ensure that it is correct. If we are at all unsure of the
safety here, I would prefer to abandon this change.
Refs: #32226
Refs: #43921