Skip to content

Commit

Permalink
fixup: crypto: reduce range of size to int max
Browse files Browse the repository at this point in the history
  • Loading branch information
Ayase-252 committed Apr 5, 2021
1 parent d2745cb commit 8bb0398
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 0 additions & 1 deletion lib/internal/crypto/random.js
Expand Up @@ -89,7 +89,6 @@ function assertSize(size, elementSize, offset, length) {
}

function randomBytes(size, callback) {
const kMaxSize = 2 ** 31 - 1
size = assertSize(size, 1, 0, Infinity);
if (callback !== undefined) {
validateCallback(callback);
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-crypto-random.js
Expand Up @@ -32,7 +32,7 @@ const cryptop = require('crypto').webcrypto;
const { kMaxLength } = require('buffer');
const { inspect } = require('util');

const kMaxInt32 = 2 ** 31 - 1
const kMaxInt32 = 2 ** 31 - 1;
const kMaxPossibleLength = Math.min(kMaxLength, kMaxInt32);

common.expectWarning('DeprecationWarning',
Expand Down

0 comments on commit 8bb0398

Please sign in to comment.