Skip to content
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

src: replace impossible THROW with CHECK #47168

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 1 addition & 5 deletions src/crypto/crypto_dsa.cc
Expand Up @@ -83,16 +83,12 @@ Maybe<bool> DsaKeyGenTraits::AdditionalConfig(
const FunctionCallbackInfo<Value>& args,
unsigned int* offset,
DsaKeyPairGenConfig* params) {
Environment* env = Environment::GetCurrent(args);
CHECK(args[*offset]->IsUint32()); // modulus bits
CHECK(args[*offset + 1]->IsInt32()); // divisor bits

params->params.modulus_bits = args[*offset].As<Uint32>()->Value();
params->params.divisor_bits = args[*offset + 1].As<Int32>()->Value();
if (params->params.divisor_bits < -1) {
THROW_ERR_OUT_OF_RANGE(env, "invalid value for divisor_bits");
return Nothing<bool>();
}
CHECK_GE(params->params.divisor_bits, -1);

*offset += 2;

Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-crypto-keygen.js
Expand Up @@ -1278,7 +1278,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
}

// Test invalid divisor lengths. (out of range)
for (const divisorLength of [-6, -9, 2147483648]) {
for (const divisorLength of [-1, -6, -9, 2147483648]) {
assert.throws(() => generateKeyPair('dsa', {
modulusLength: 2048,
divisorLength
Expand Down