| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Change types of all PBKDF2 params to `int` as they are `int` in `evp.h`. Check that `raw_keylen` fits into `int` before passing it to OpenSSL. Fix: nodejs#5396
|
cc @nodejs/crypto R = @bnoordhuis or @shigeki |
Sorry, something went wrong.
|
ACK. |
Sorry, something went wrong.
|
LGTM if CI is fine. |
Sorry, something went wrong.
|
@shigeki I'm afraid that CI is down 😢 (please pardon my terrible sense of humor). |
Sorry, something went wrong.
Sorry, something went wrong.
| crypto.pbkdf2('password', 'salt', 1, 4073741824, 'sha256', common.fail); | ||
| }, function(err) { | ||
| return err instanceof Error && err.message === 'Bad key length'; | ||
| }); |
There was a problem hiding this comment.
You can condense the check callback to just /Bad key length/.
Sorry, something went wrong.
There was a problem hiding this comment.
Ack.
Sorry, something went wrong.
|
LGTM with a suggestion. |
Sorry, something went wrong.
Sorry, something went wrong.
|
@bnoordhuis I took some courage and changed the rest of "Bad key length" occurrences. Hopefully this is OK to you. |
Sorry, something went wrong.
|
CI is unhappy with the change. Looks like I will need to study this a bit more than I thought. |
Sorry, something went wrong.
| keylen = args[3]->NumberValue(); | ||
| if (keylen < 0 || isnan(keylen) || isinf(keylen)) { | ||
| raw_keylen = args[3]->NumberValue(); | ||
| if (raw_keylen < 0.0 || isnan(raw_keylen) || isinf(raw_keylen)) { |
There was a problem hiding this comment.
You should probably write this as:
if (!std::isfinite(raw_keylen) || raw_keylen < 0 || raw_keylen > INT_MAX) {
// ...
}
Sorry, something went wrong.
There was a problem hiding this comment.
Ack.
Sorry, something went wrong.
Sorry, something went wrong.
|
CI is green, the commit goes in. Landed in da3f425, thank you everyone! |
Sorry, something went wrong.
Change types of all PBKDF2 params to `int` as they are `int` in `evp.h`. Check that `raw_keylen` fits into `int` before passing it to OpenSSL. Fix: #5396 PR-URL: #5397 Reviewed-By: Shigeki Ohtsu <ohtsu@iij.ad.jp> Reviewed-By: Ben Noorhduis <info@bnoordhuis.nl> Conflicts: test/parallel/test-crypto-pbkdf2.js
| Back | FazBrowse Home | New Git URL |
Pull Request check-list
Please make sure to review and check all of these items:
this change (including linting)?
test (or a benchmark) included?
existing APIs, or introduces new ones)?
NOTE: these things are not required to open a PR and can be done afterwards /
while the PR is open.
Affected core subsystem(s)
Please provide affected core subsystem(s) (like buffer, cluster, crypto, etc)
Description of change
Change types of all PBKDF2 params to int as they are int in evp.h.
Check that raw_keylen fits into int before passing it to OpenSSL.
Fix: #5396