-
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
node 0.10, more checks for keylen #27
Conversation
I haven't got time to merge this at the moment. Once-over looks good. |
this does much more then simply update the keylen checks, can you add some comments in the pull to make it easeir to review the changes ? |
@calvinmetcalf if you have any questions, please ask! |
@@ -34,20 +14,33 @@ function checkParameters (iterations, keylen) { | |||
throw new TypeError('Key length not a number') | |||
} | |||
|
|||
if (keylen < 0 || keylen > MAX_ALLOC) { | |||
if (keylen < 0 || isNaN(keylen) || keylen > MAX_ALLOC) { |
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.
probably want to do keylen !== keylen
as older browsers aren't going to have isNaN
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.
in lodash
isNaN
: value != +value
https://github.com/lodash/lodash/blob/092f90d2fca959fa75d14cae8a2377a58bcb122d/lodash.js#L10534
or better will use keylen !== keylen
?
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.
lodash is making sure it's a number, but we already have a check to do that
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.
done
b0d1399
to
f252609
Compare
|
||
digest = digest || 'sha1' | ||
exports._checkParameters(iterations, keylen) |
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.
why don't we pull check paramaters into it's own file and require it from both locations
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.
it's a good idea, I'll do this
get rid of the browser._createHmac stuff and fix the typo and I'm good to merge this thank you for the work |
4c71354
to
b080e6e
Compare
b080e6e
to
93ffd51
Compare
@calvinmetcalf done. Thank you that checked this! |
Please rename |
Another attempt (summary of #22 #23 #25 #26)