-
Notifications
You must be signed in to change notification settings - Fork 60
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 more checks for keylen #23
Conversation
$ node -v
v5.6.0
$ node
> require('crypto').pbkdf2Sync('password', 'salt', 1, NaN)
TypeError: Bad key length
$ nvm use 0.10
$ node -v
v0.10.42
$ node
> require('crypto').pbkdf2Sync('password', 'salt', 1, NaN)
<SlowBuffer > Different behavior for different node versions :( |
@@ -3,6 +3,10 @@ var compatNode = require('../') | |||
var compatBrowser = require('../browser') | |||
var fixtures = require('./fixtures') | |||
|
|||
// put NaN and Infinity | |||
fixtures.invalid[fixtures.invalid.length - 2].dkLen = NaN | |||
fixtures.invalid[fixtures.invalid.length - 1].dkLen = Infinity |
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'd rather add these fixtures inline here, then do this weird modification which is error prone for others adding tests.
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.
Agree, any ideas how tests dkLen with NaN
and Infinity
?
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.
What do you mean?
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.
oops, sorry
95120f2
to
f64f48d
Compare
f64f48d
to
b1fff11
Compare
updated |
... all failed except Node 4? Interesting |
1) node pbkdf2 pbkdf2-compat pbkdf2Sync sha[1/224/256/384/512] should throw Bad key length:
AssertionError: Missing expected exception..
at Function._throws (assert.js:301:5)
at Function.assert.throws (assert.js:318:11)
at Context.<anonymous> (test/index.js:95:24) |
What version of node v4 you are using? May be your version not include nodejs/node@4c8d96b ? (checks on |
@fanatid I'm referring to the CI. |
@dcousens I'll fix with this PR after nodejs/node#5397 will be merged and released |
merged as part of #27 |
Part of #22