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.slice: Document behavior if end > slice.length #14714

Closed
kevinburke opened this issue Aug 9, 2017 · 4 comments
Closed

Buffer.slice: Document behavior if end > slice.length #14714

kevinburke opened this issue Aug 9, 2017 · 4 comments
Labels
buffer Issues and PRs related to the buffer subsystem. doc Issues and PRs related to the documentations. wip Issues and PRs that are still a work in progress.

Comments

@kevinburke
Copy link

The documentation for Buffer.slice says this about end:

end Where the new Buffer will end (not inclusive). Default: buf.length

It does not describe what happens if end is greater than the length of the buffer. Does Node return a buffer of length (end - start) with zero values for the extra values? Does it return a shorter buffer? Does it throw a RangeError?

@tniessen tniessen added the doc Issues and PRs related to the documentations. label Aug 9, 2017
@cjihrig
Copy link
Contributor

cjihrig commented Aug 9, 2017

Care to submit a documentation PR?

@mscdex mscdex added the buffer Issues and PRs related to the buffer subsystem. label Aug 9, 2017
vishal7201 added a commit to vishal7201/node that referenced this issue Aug 9, 2017
@refack refack added the wip Issues and PRs that are still a work in progress. label Aug 9, 2017
@kevinburke
Copy link
Author

kevinburke commented Aug 10, 2017 via email

@cjihrig
Copy link
Contributor

cjihrig commented Aug 10, 2017

Looks like it's been taken care of: #14720

@refack refack closed this as completed Aug 12, 2017
addaleax pushed a commit that referenced this issue Aug 12, 2017
Added description for the case when `end` is greater than buffer length

PR-URL: #14720
Fixes: #14714
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@kevinburke
Copy link
Author

kevinburke commented Aug 12, 2017 via email

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. doc Issues and PRs related to the documentations. wip Issues and PRs that are still a work in progress.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants