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: SlowBuffer() asserts when invoked without arguments. #2634

Closed
ChALkeR opened this issue Sep 1, 2015 · 5 comments
Closed

buffer: SlowBuffer() asserts when invoked without arguments. #2634

ChALkeR opened this issue Sep 1, 2015 · 5 comments
Labels
buffer Issues and PRs related to the buffer subsystem. c++ Issues and PRs that require attention from people who are familiar with C++.

Comments

@ChALkeR
Copy link
Member

ChALkeR commented Sep 1, 2015

io.js 3.2.0.

$ iojs
> require('buffer').SlowBuffer();
iojs: ../src/node_buffer.cc:400: void node::Buffer::Create(const v8::FunctionCallbackInfo<v8::Value>&): Assertion `args[0]->IsNumber()' failed.
Aborted
@ChALkeR ChALkeR added buffer Issues and PRs related to the buffer subsystem. c++ Issues and PRs that require attention from people who are familiar with C++. labels Sep 1, 2015
@targos
Copy link
Member

targos commented Sep 1, 2015

cc @trevnorris

@ChALkeR
Copy link
Member Author

ChALkeR commented Sep 1, 2015

The same with SlowBuffer('foo'), SlowBuffer('10'), SlowBuffer({}) — any non-number causes an assertion.

@targos
Copy link
Member

targos commented Sep 1, 2015

fix: #2635

@trevnorris
Copy link
Contributor

My bad. Didn't add the proper coercion before length hit the native CHECK().

targos added a commit to targos/node that referenced this issue Sep 4, 2015
Fixes a regression that appeared with the new Buffer implementation in v3.
Without this change, calling the SlowBuffer constructor with something else
than a number would abort on the C++ side. This makes sure that the length
argument is coerced to number or is 0.

Fixes: nodejs#2634
PR-URL: nodejs#2635
Reviewed-By: trevnorris - Trevor Norris <trev.norris@gmail.com>
Reviewed-By: cjihrig - Colin Ihrig <cjihrig@gmail.com>
@targos
Copy link
Member

targos commented Sep 4, 2015

fixed by eefe14c

@targos targos closed this as completed Sep 4, 2015
targos added a commit that referenced this issue Sep 5, 2015
Fixes a regression that appeared with the new Buffer implementation in v3.
Without this change, calling the SlowBuffer constructor with something else
than a number would abort on the C++ side. This makes sure that the length
argument is coerced to number or is 0.

Fixes: #2634
PR-URL: #2635
Reviewed-By: trevnorris - Trevor Norris <trev.norris@gmail.com>
Reviewed-By: cjihrig - Colin Ihrig <cjihrig@gmail.com>
targos added a commit that referenced this issue Sep 5, 2015
Fixes a regression that appeared with the new Buffer implementation in v3.
Without this change, calling the SlowBuffer constructor with something else
than a number would abort on the C++ side. This makes sure that the length
argument is coerced to number or is 0.

Fixes: #2634
PR-URL: #2635
Reviewed-By: trevnorris - Trevor Norris <trev.norris@gmail.com>
Reviewed-By: cjihrig - Colin Ihrig <cjihrig@gmail.com>
targos added a commit that referenced this issue Sep 6, 2015
Fixes a regression that appeared with the new Buffer implementation in v3.
Without this change, calling the SlowBuffer constructor with something else
than a number would abort on the C++ side. This makes sure that the length
argument is coerced to number or is 0.

Fixes: #2634
PR-URL: #2635
Reviewed-By: trevnorris - Trevor Norris <trev.norris@gmail.com>
Reviewed-By: cjihrig - Colin Ihrig <cjihrig@gmail.com>
targos added a commit that referenced this issue Sep 6, 2015
Fixes a regression that appeared with the new Buffer implementation in v3.
Without this change, calling the SlowBuffer constructor with something else
than a number would abort on the C++ side. This makes sure that the length
argument is coerced to number or is 0.

Fixes: #2634
PR-URL: #2635
Reviewed-By: trevnorris - Trevor Norris <trev.norris@gmail.com>
Reviewed-By: cjihrig - Colin Ihrig <cjihrig@gmail.com>
targos added a commit that referenced this issue Sep 6, 2015
Fixes a regression that appeared with the new Buffer implementation in v3.
Without this change, calling the SlowBuffer constructor with something else
than a number would abort on the C++ side. This makes sure that the length
argument is coerced to number or is 0.

Fixes: #2634
PR-URL: #2635
Reviewed-By: trevnorris - Trevor Norris <trev.norris@gmail.com>
Reviewed-By: cjihrig - Colin Ihrig <cjihrig@gmail.com>
targos added a commit that referenced this issue Sep 6, 2015
Fixes a regression that appeared with the new Buffer implementation in v3.
Without this change, calling the SlowBuffer constructor with something else
than a number would abort on the C++ side. This makes sure that the length
argument is coerced to number or is 0.

Fixes: #2634
PR-URL: #2635
Reviewed-By: trevnorris - Trevor Norris <trev.norris@gmail.com>
Reviewed-By: cjihrig - Colin Ihrig <cjihrig@gmail.com>
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. c++ Issues and PRs that require attention from people who are familiar with C++.
Projects
None yet
Development

No branches or pull requests

3 participants