crypto: add more keylen sanity checks in pbkdf2
authorJohann <git@johann-hofmann.com>
Wed, 23 Sep 2015 16:42:20 +0000 (18:42 +0200)
committerRod Vagg <rod@vagg.org>
Wed, 30 Sep 2015 06:02:12 +0000 (16:02 +1000)
commit4c8d96bc30281d77ab556adfe9cc1f91e0db4522
tree057f422accb1028d50735e3c02eef33df48da5a9
parent798dad24f408327625f47705c2bb00f9e71d08b4
crypto: add more keylen sanity checks in pbkdf2

issue #2987 makes the point that crypto.pbkdf2 should not fail silently
and accept invalid but numeric values like NaN and Infinity. We already
check if the keylen is lower than 0, so extending that to NaN and
Infinity should make sense.

Fixes: https://github.com/nodejs/node/issues/2987

PR-URL: https://github.com/nodejs/node/pull/3029
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
src/node_crypto.cc
test/parallel/test-crypto-pbkdf2.js