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

Create Buffer from Object missing null check #2194

Closed
Cellule opened this issue Jul 16, 2015 · 3 comments
Closed

Create Buffer from Object missing null check #2194

Cellule opened this issue Jul 16, 2015 · 3 comments
Labels
buffer Issues and PRs related to the buffer subsystem.

Comments

@Cellule
Copy link

Cellule commented Jul 16, 2015

In next branch
If I run new Buffer() I get the error

TypeError: Unable to get property 'buffer' of undefined or null reference
   at fromObject (buffer.js:112:3)

When the error used to be

TypeError: must start with number, buffer, array or string
   at fromObject (buffer.js:109:5)

In fromObject the following check got lost in rework
https://github.com/nodejs/io.js/pull/1825/files#diff-196d056a936b6d2649721eb639e0442bL84
when buffer code went into lib/internal/buffer_new.js
https://github.com/nodejs/io.js/pull/1825/files#diff-c28ab5e2f9b7f2f9890ac44e7370af59R107

  if (obj == null)
    throw new TypeError('must start with number, buffer, array or string');

  if (obj instanceof ArrayBuffer) {
    return binding.createFromArrayBuffer(obj);
  }
@brendanashworth brendanashworth added the buffer Issues and PRs related to the buffer subsystem. label Jul 16, 2015
@brendanashworth
Copy link
Contributor

@trevnorris ?

@trevnorris
Copy link
Contributor

Thanks for reporting this. I've filed a fix at #2195

trevnorris added a commit to trevnorris/node that referenced this issue Jul 22, 2015
The new implementation of Buffer missed the check for null/undefined as
the first argument to new Buffer(). Reintroduce the check and add test.

Fix: e8734c0 "buffer: implement Uint8Array backed Buffer"
Fix: nodejs#2194
trevnorris added a commit that referenced this issue Jul 27, 2015
The new implementation of Buffer missed the check for null/undefined as
the first argument to new Buffer(). Reintroduce the check and add test.

Fix: e8734c0 "buffer: implement Uint8Array backed Buffer"
Fix: #2194
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Rod Vagg <[email protected]>
@trevnorris
Copy link
Contributor

Fixed by 9cf36a1.

trevnorris added a commit that referenced this issue Jul 30, 2015
The new implementation of Buffer missed the check for null/undefined as
the first argument to new Buffer(). Reintroduce the check and add test.

Fix: e8734c0 "buffer: implement Uint8Array backed Buffer"
Fix: #2194
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Rod Vagg <[email protected]>
trevnorris added a commit that referenced this issue Aug 1, 2015
The new implementation of Buffer missed the check for null/undefined as
the first argument to new Buffer(). Reintroduce the check and add test.

Fix: e8734c0 "buffer: implement Uint8Array backed Buffer"
Fix: #2194
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Rod Vagg <[email protected]>
trevnorris added a commit that referenced this issue Aug 3, 2015
The new implementation of Buffer missed the check for null/undefined as
the first argument to new Buffer(). Reintroduce the check and add test.

Fix: e8734c0 "buffer: implement Uint8Array backed Buffer"
Fix: #2194
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Rod Vagg <[email protected]>
trevnorris added a commit that referenced this issue Aug 4, 2015
The new implementation of Buffer missed the check for null/undefined as
the first argument to new Buffer(). Reintroduce the check and add test.

Fix: e8734c0 "buffer: implement Uint8Array backed Buffer"
Fix: #2194
PR-URL: #2195
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Rod Vagg <[email protected]>
trevnorris added a commit that referenced this issue Aug 4, 2015
The new implementation of Buffer missed the check for null/undefined as
the first argument to new Buffer(). Reintroduce the check and add test.

Fix: e8734c0 "buffer: implement Uint8Array backed Buffer"
Fix: #2194
PR-URL: #2195
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Rod Vagg <[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.
Projects
None yet
Development

No branches or pull requests

3 participants