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

buffer: fix copy() segfault with zero arguments #1520

Closed
wants to merge 1 commit into from

Conversation

trevnorris
Copy link
Contributor

Buffer#copy() immediately does a ToObject() on the first argument before
it checks if it's even an Object. This causes
Object::HasIndexedPropertiesInExternalArrayData() to be run on nothing,
triggering the segfault. Instead run HasInstance() on the args Value.
Which will check if it's actually an Object, before checking if it
contains data.

Fixes: #1519

@evanlucas
Copy link
Contributor

LGTM

Buffer#copy() immediately does a ToObject() on the first argument before
it checks if it's even an Object. This causes
Object::HasIndexedPropertiesInExternalArrayData() to be run on nothing,
triggering the segfault. Instead run HasInstance() on the args Value.
Which will check if it's actually an Object, before checking if it
contains data.

Fixes: nodejs#1519
@mscdex mscdex added the buffer Issues and PRs related to the buffer subsystem. label Apr 24, 2015
trevnorris added a commit that referenced this pull request Apr 24, 2015
Buffer#copy() immediately does a ToObject() on the first argument before
it checks if it's even an Object. This causes
Object::HasIndexedPropertiesInExternalArrayData() to be run on nothing,
triggering the segfault. Instead run HasInstance() on the args Value.
Which will check if it's actually an Object, before checking if it
contains data.

Fixes: #1519
PR-URL: #1520
Reviewed-by: Evan Lucas <[email protected]>
@trevnorris
Copy link
Contributor Author

Landed in 5404cbc.

@trevnorris trevnorris closed this Apr 24, 2015
@trevnorris trevnorris deleted the buff-copy-segfault-fix branch April 24, 2015 20:08
Fishrock123 pushed a commit to Fishrock123/node that referenced this pull request Apr 29, 2015
Buffer#copy() immediately does a ToObject() on the first argument before
it checks if it's even an Object. This causes
Object::HasIndexedPropertiesInExternalArrayData() to be run on nothing,
triggering the segfault. Instead run HasInstance() on the args Value.
Which will check if it's actually an Object, before checking if it
contains data.

Fixes: nodejs#1519
PR-URL: nodejs#1520
Reviewed-by: Evan Lucas <[email protected]>
Fishrock123 pushed a commit to Fishrock123/node that referenced this pull request Apr 30, 2015
Buffer#copy() immediately does a ToObject() on the first argument before
it checks if it's even an Object. This causes
Object::HasIndexedPropertiesInExternalArrayData() to be run on nothing,
triggering the segfault. Instead run HasInstance() on the args Value.
Which will check if it's actually an Object, before checking if it
contains data.

Fixes: nodejs#1519
PR-URL: nodejs#1520
PORT-PR-URL: nodejs#1559
Reviewed-by: Evan Lucas <[email protected]>
@rvagg rvagg mentioned this pull request May 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
buffer Issues and PRs related to the buffer subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants