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: stricter from() input validation #26825

Closed
wants to merge 2 commits into from

Conversation

BridgeAR
Copy link
Member

So far we did not throw an error for all types of invalid input.
Functions do not return a buffer anymore and number and symbol
validation is also improved.

@cjihrig you opened your PR (#26743) to address the function part first. Please feel free to reopen your PR and I'll either rebase on top of your or just close mine if you would like to pull in my changes.

@ChALkeR you also said that you have a PR almost ready, I am happy to close this one.

@nodejs/tsc is this semver-major because of the function validation (if a function is passed in, it seems like a bug, so I am not sure)? The message part is AFAIK not semver-major.

Fixes: #26741

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

So far we did not throw an error for all types of invalid input.
Functions do not return a buffer anymore and `number` and `symbol`
validation is also improved.
@nodejs-github-bot nodejs-github-bot added the buffer Issues and PRs related to the buffer subsystem. label Mar 20, 2019
@BridgeAR
Copy link
Member Author

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Recent code changes require this change.
@BridgeAR
Copy link
Member Author

@BridgeAR BridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Mar 24, 2019
@Fishrock123
Copy link
Contributor

Yeah I guess the function thing is technically semver-major but it is quite certainly an error and trap.

@BridgeAR
Copy link
Member Author

@nodejs/buffer PTAL

lib/buffer.js Show resolved Hide resolved
@BridgeAR BridgeAR requested a review from Trott March 28, 2019 20:41
@BridgeAR
Copy link
Member Author

@mcollina
Copy link
Member

I’m fine as patch.

@targos
Copy link
Member

targos commented Mar 30, 2019

Landed in 75eaf25

@targos targos closed this Mar 30, 2019
targos pushed a commit that referenced this pull request Mar 30, 2019
So far we did not throw an error for all types of invalid input.
Functions do not return a buffer anymore and `number` and `symbol`
validation is also improved.

PR-URL: #26825
Fixes: #26741
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
BethGriggs pushed a commit that referenced this pull request Apr 5, 2019
So far we did not throw an error for all types of invalid input.
Functions do not return a buffer anymore and `number` and `symbol`
validation is also improved.

PR-URL: #26825
Fixes: #26741
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
BethGriggs pushed a commit that referenced this pull request Apr 9, 2019
So far we did not throw an error for all types of invalid input.
Functions do not return a buffer anymore and `number` and `symbol`
validation is also improved.

PR-URL: #26825
Fixes: #26741
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Signed-off-by: Beth Griggs <Bethany.Griggs@uk.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. buffer Issues and PRs related to the buffer subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Buffer.from(function) should probably fail
6 participants