-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
buffer: neuter external nullptr
buffers
#3624
Conversation
Fixes the issue for me. 👍 |
Not that you need help kicking of a CI job, but I did it anyway: https://ci.nodejs.org/job/node-test-pull-request/657/ |
CI looks green, thank you @Trott |
cc @nodejs/collaborators I would like to get LGTM from either @trevnorris or @bnoordhuis before landing it. |
btw, other reviews are more than welcome! |
LGTM Would you consider this a v8 bug? |
@@ -362,6 +362,8 @@ MaybeLocal<Object> New(Environment* env, | |||
} | |||
|
|||
Local<ArrayBuffer> ab = ArrayBuffer::New(env->isolate(), data, length); | |||
if (data == nullptr) | |||
ab->Neuter(); |
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.
Can you add a comment explaining why the Neuter() call is necessary?
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.
Yep, will do.
LGTM with comments. |
@@ -0,0 +1,7 @@ | |||
'use strict'; | |||
// Flags: --expose-gc |
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.
Is this flag necessary here?
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.
Yes. Without it, v8::Isolate::RequestGarbageCollectionForTesting()
aborts with a run-time error.
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.
Ah ok, didn't realize that
Neuter external `nullptr` buffers, otherwise their contents will be materialized on access, and the buffer instance will be internalized. This leads to a crash like this: v8::ArrayBuffer::Neuter Only externalized ArrayBuffers can be neutered Fix: nodejs#3619
@trevnorris I'm not sure, maybe a documentation bug. Filed an issue: https://code.google.com/p/v8/issues/detail?id=4530 |
@nodejs/release how do I mark it to be landed on v5? |
Landed in master in 827ee49, thank you everyone! |
Neuter external `nullptr` buffers, otherwise their contents will be materialized on access, and the buffer instance will be internalized. This leads to a crash like this: v8::ArrayBuffer::Neuter Only externalized ArrayBuffers can be neutered Fix: #3619 PR-URL: #3624 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
I'm unable to find anything about who can propose releases and how, but is this a sufficiently significant bug/fix that a 5.0.1 release should happen as soon as is reasonable? Breaking nativescript and ffi seems significant to me, but I don't know what the agreed-upon litmus test (if any) is. |
Does this affect LTS? |
@trevnorris nope, it just gets raw |
Neuter external `nullptr` buffers, otherwise their contents will be materialized on access, and the buffer instance will be internalized. This leads to a crash like this: v8::ArrayBuffer::Neuter Only externalized ArrayBuffers can be neutered Fix: #3619 PR-URL: #3624 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
This call was introduced in 827ee49 to avoid a crash in a later `Neuter()` call that has later been removed in ebbbc5a, rendering the original call unnecessary. Refs: nodejs#3624 Refs: nodejs#5204
This call was introduced in 827ee49 to avoid a crash in a later `Neuter()` call that has later been removed in ebbbc5a, rendering the original call unnecessary. Refs: nodejs/node#3624 Refs: nodejs/node#5204 PR-URL: nodejs/node#25479 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Neuter external
nullptr
buffers, otherwise their contents will be materialized on access, and the buffer instance will be internalized.This leads to a crash like this:
Fix: #3619
cc @Trott @trevnorris