Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.3k
crypto: refactor array buffer view validation#29683
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
This is just a refactoring to reduce code and computational overhead.
| if(typeofdata!=='string'&&!isArrayBufferView(data)){ | ||
| throwinvalidArrayBufferView('data',data); | ||
| thrownewERR_INVALID_ARG_TYPE( | ||
| 'data',['string','Buffer','TypedArray','DataView'],data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nodejs/crypto all other cases that validate the input like that convert strings to buffers before passing the data on. Is it intentional, that this is not done here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BridgeAR Should we pull the author ready label until we get an answer for this question? Or are you comfortable landing as-is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am comfortable to land this as-is. It's mainly about consistency and the behavior is not changed with this PR.
nodejs-github-bot commented Sep 24, 2019
Trott commented Sep 25, 2019
CI passed, if that encourages anyone to take a closer look. |
Trott commented Oct 1, 2019
Removed |
Trott commented Oct 1, 2019
Also: Should this be benchmarked? |
BridgeAR commented Oct 1, 2019
@Trott this should not have any real performance impact. It might actually be faster due to some redundant typeof checks being removed. |
This is just a refactoring to reduce code and computational overhead. PR-URL: #29683 Reviewed-By: James M Snell <[email protected]>
BridgeAR commented Oct 1, 2019
Landed in eb05d68 |
This is just a refactoring to reduce code and computational overhead. PR-URL: #29683 Reviewed-By: James M Snell <[email protected]>
This is just a refactoring to reduce code and computational overhead.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes