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

segmentation fault for buffer.copy() with no args #1519

Closed
timoxley opened this issue Apr 24, 2015 · 2 comments
Closed

segmentation fault for buffer.copy() with no args #1519

timoxley opened this issue Apr 24, 2015 · 2 comments
Labels
buffer Issues and PRs related to the buffer subsystem. confirmed-bug Issues with confirmed bugs.

Comments

@timoxley
Copy link
Contributor

To reproduce from the command line:

$ iojs -e "Buffer(10).copy()"
[1]    87376 segmentation fault  iojs -e "Buffer(10).copy()"

While this isn't valid input to copy, this should probably not segfault.

Tested on iojs 1.8.1. Same issue in node 0.12.2.

@trevnorris
Copy link
Contributor

Have a patch coming.

trevnorris added a commit to trevnorris/node that referenced this issue 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: nodejs#1519
trevnorris added a commit to trevnorris/node that referenced this issue 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: nodejs#1519
trevnorris added a commit to trevnorris/node that referenced this issue 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: nodejs#1519
@mscdex mscdex added confirmed-bug Issues with confirmed bugs. buffer Issues and PRs related to the buffer subsystem. labels Apr 24, 2015
trevnorris added a commit that referenced this issue 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

Fixed by 5404cbc.

Fishrock123 pushed a commit to Fishrock123/node that referenced this issue 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 issue 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]>
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. confirmed-bug Issues with confirmed bugs.
Projects
None yet
Development

No branches or pull requests

3 participants