summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTobias Nießen <tniessen@tnie.de>2023-04-17 19:26:02 +0200
committerGitHub <noreply@github.com>2023-04-17 17:26:02 +0000
commitb342a1b5652785cc08238ddd26f7dc13ad61a622 (patch)
treeb126ed5f97549eae6b60127abd0241fe670aa018 /src
parente050cecad1887c2bda875f2a9c01360f21744452 (diff)
downloadnode-new-b342a1b5652785cc08238ddd26f7dc13ad61a622.tar.gz
crypto: remove INT_MAX restriction in randomBytes
This restriction was due to an implementation detail in CSPRNG(). Now that CSPRNG() properly handles lengths exceeding INT_MAX, remove this artificial restriction. Refs: https://github.com/nodejs/node/pull/47515 PR-URL: https://github.com/nodejs/node/pull/47559 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/crypto/crypto_random.cc6
1 files changed, 0 insertions, 6 deletions
diff --git a/src/crypto/crypto_random.cc b/src/crypto/crypto_random.cc
index 272dbdaf7c..9850104cd6 100644
--- a/src/crypto/crypto_random.cc
+++ b/src/crypto/crypto_random.cc
@@ -39,7 +39,6 @@ Maybe<bool> RandomBytesTraits::AdditionalConfig(
const FunctionCallbackInfo<Value>& args,
unsigned int offset,
RandomBytesConfig* params) {
- Environment* env = Environment::GetCurrent(args);
CHECK(IsAnyByteSource(args[offset])); // Buffer to fill
CHECK(args[offset + 1]->IsUint32()); // Offset
CHECK(args[offset + 2]->IsUint32()); // Size
@@ -51,11 +50,6 @@ Maybe<bool> RandomBytesTraits::AdditionalConfig(
CHECK_GE(byte_offset + size, byte_offset); // Overflow check.
CHECK_LE(byte_offset + size, in.size()); // Bounds check.
- if (UNLIKELY(size > INT_MAX)) {
- THROW_ERR_OUT_OF_RANGE(env, "buffer is too large");
- return Nothing<bool>();
- }
-
params->buffer = in.data() + byte_offset;
params->size = size;