| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 1641a28 commit 890eef2
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -176,6 +176,11 @@ Maybe<void> CheckPrimeTraits::AdditionalConfig( | |||
| 176 | 176 | ArrayBufferOrViewContents<unsigned char> candidate(args[offset]); | |
| 177 | 177 | ||
| 178 | 178 | params->candidate = BignumPointer(candidate.data(), candidate.size()); | |
| 179 | + if (!params->candidate) { | ||
| 180 | + ThrowCryptoError( | ||
| 181 | + Environment::GetCurrent(args), ERR_get_error(), "BignumPointer"); | ||
| 182 | + return Nothing<void>(); | ||
| 183 | + } | ||
| 179 | 184 | ||
| 180 | 185 | CHECK(args[offset + 1]->IsInt32()); // Checks | |
| 181 | 186 | params->checks = args[offset + 1].As<Int32>()->Value(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -254,6 +254,19 @@ for (const checks of [-(2 ** 31), -1, 2 ** 31, 2 ** 32 - 1, 2 ** 32, 2 ** 50]) { | |||
| 254 | 254 | }); | |
| 255 | 255 | } | |
| 256 | 256 | ||
| 257 | + { | ||
| 258 | + const bytes = Buffer.alloc(67108864); | ||
| 259 | + bytes[0] = 0x1; | ||
| 260 | + assert.throws(() => checkPrime(bytes, common.mustNotCall()), { | ||
| 261 | + code: 'ERR_OSSL_BN_BIGNUM_TOO_LONG', | ||
| 262 | + message: /bignum too long/ | ||
| 263 | + }); | ||
| 264 | + assert.throws(() => checkPrimeSync(bytes), { | ||
| 265 | + code: 'ERR_OSSL_BN_BIGNUM_TOO_LONG', | ||
| 266 | + message: /bignum too long/ | ||
| 267 | + }); | ||
| 268 | + } | ||
| 269 | + | ||
| 257 | 270 | assert(!checkPrimeSync(Buffer.from([0x1]))); | |
| 258 | 271 | assert(checkPrimeSync(Buffer.from([0x2]))); | |
| 259 | 272 | assert(checkPrimeSync(Buffer.from([0x3]))); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments