Skip to content

Add assert.equal for length of Buffer.concat(list, length) #11605

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
JacksonTian opened this issue Feb 28, 2017 · 2 comments
Closed

Add assert.equal for length of Buffer.concat(list, length) #11605

JacksonTian opened this issue Feb 28, 2017 · 2 comments
Labels
buffer Issues and PRs related to the buffer subsystem.

Comments

@JacksonTian
Copy link
Contributor

  • Version: all
  • Platform: all
  • Subsystem: buffer

I don't know why/when user pass into invalid length. Hope to get more points for it.

@addaleax addaleax added the buffer Issues and PRs related to the buffer subsystem. label Feb 28, 2017
@cjihrig
Copy link
Contributor

cjihrig commented Feb 28, 2017

Is your question why this returns an empty buffer instead of throwing:

const buf = Buffer.concat([Buffer.from('abc'), Buffer.from('def')], 'xyz');

Or why this automatically truncates instead of throwing:

Buffer.concat([Buffer.from('abc'), Buffer.from('def')], 1)

Or something else?

@JacksonTian
Copy link
Contributor Author

Thanks, @cjihrig . That's my point.

italoacasas pushed a commit to italoacasas/node that referenced this issue Mar 20, 2017
This commit adds documentation for two edge cases in
Buffer.concat(). Those cases are:

- totalLength is specified, but is not an integer.
- The combined buffer length is greater than totalLength.

PR-URL: nodejs#11845
Fixes: nodejs#11605
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
jungx098 pushed a commit to jungx098/node that referenced this issue Mar 21, 2017
This commit adds documentation for two edge cases in
Buffer.concat(). Those cases are:

- totalLength is specified, but is not an integer.
- The combined buffer length is greater than totalLength.

PR-URL: nodejs#11845
Fixes: nodejs#11605
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
gibfahn pushed a commit that referenced this issue Jun 19, 2017
This commit adds documentation for two edge cases in
Buffer.concat(). Those cases are:

- totalLength is specified, but is not an integer.
- The combined buffer length is greater than totalLength.

PR-URL: #11845
Fixes: #11605
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
gibfahn pushed a commit that referenced this issue Jun 20, 2017
This commit adds documentation for two edge cases in
Buffer.concat(). Those cases are:

- totalLength is specified, but is not an integer.
- The combined buffer length is greater than totalLength.

PR-URL: #11845
Fixes: #11605
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
MylesBorins pushed a commit that referenced this issue Jul 11, 2017
This commit adds documentation for two edge cases in
Buffer.concat(). Those cases are:

- totalLength is specified, but is not an integer.
- The combined buffer length is greater than totalLength.

PR-URL: #11845
Fixes: #11605
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
buffer Issues and PRs related to the buffer subsystem.
Projects
None yet
Development

No branches or pull requests

3 participants