Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4add368

Browse filesBrowse files
tniessendanielleadams
authored andcommitted
src: replace impossible THROW with CHECK
The JS layer already verifies that divisor_bits is either a non-negative 32-bit signed integer or null/undefined, in which case it passes -1 to the C++ layer. In either case, the C++ layer receives a 32-bit signed integer greater than or equal to -1. PR-URL: #47168 Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent dd42214 commit 4add368
Copy full SHA for 4add368

File tree

Expand file treeCollapse file tree

2 files changed

+2
-6
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+2
-6
lines changed
Open diff view settings
Collapse file

‎src/crypto/crypto_dsa.cc‎

Copy file name to clipboardExpand all lines: src/crypto/crypto_dsa.cc
+1-5Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,12 @@ Maybe<bool> DsaKeyGenTraits::AdditionalConfig(
8383
const FunctionCallbackInfo<Value>& args,
8484
unsigned int* offset,
8585
DsaKeyPairGenConfig* params) {
86-
Environment* env = Environment::GetCurrent(args);
8786
CHECK(args[*offset]->IsUint32()); // modulus bits
8887
CHECK(args[*offset + 1]->IsInt32()); // divisor bits
8988

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

9793
*offset += 2;
9894

Collapse file

‎test/parallel/test-crypto-keygen.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-crypto-keygen.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1278,7 +1278,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
12781278
}
12791279

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

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.