-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
src: remove usages of GetBackingStore in crypto #44079
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
Review requested:
|
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.
lgtm
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)
|
||
inline explicit ArrayBufferOrViewContents(v8::Local<v8::Value> buf) { | ||
if (buf.IsEmpty()) { |
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.
I understand why this exists, but it feels somewhat strange to explicitly allow passing in empty Local
s.
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.
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.)
Landed in 4c725f4 |
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 <[email protected]> Reviewed-By: Feng Yu <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
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 <[email protected]> Reviewed-By: Feng Yu <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
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 <[email protected]> Reviewed-By: Feng Yu <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
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 <[email protected]> Reviewed-By: Feng Yu <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
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 <[email protected]> Reviewed-By: Feng Yu <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
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 <[email protected]> Reviewed-By: Feng Yu <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
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 <[email protected]> Reviewed-By: Feng Yu <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
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 <[email protected]> Reviewed-By: Feng Yu <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
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 <[email protected]> Reviewed-By: Feng Yu <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
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 <[email protected]> Reviewed-By: Feng Yu <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
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 <[email protected]> Reviewed-By: Feng Yu <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
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 <[email protected]> Reviewed-By: Feng Yu <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
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