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

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

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 <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
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 <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
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 <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
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 <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
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 <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Luigi Pinca <[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