Skip to content

Commit e2292f9

Browse files
tniessenMoLow
authored andcommitted
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: #47515 PR-URL: #47559 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Filip Skokan <panva.ip@gmail.com>
1 parent 261e1d2 commit e2292f9

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

src/crypto/crypto_random.cc

-6
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ Maybe<bool> RandomBytesTraits::AdditionalConfig(
3939
const FunctionCallbackInfo<Value>& args,
4040
unsigned int offset,
4141
RandomBytesConfig* params) {
42-
Environment* env = Environment::GetCurrent(args);
4342
CHECK(IsAnyByteSource(args[offset])); // Buffer to fill
4443
CHECK(args[offset + 1]->IsUint32()); // Offset
4544
CHECK(args[offset + 2]->IsUint32()); // Size
@@ -51,11 +50,6 @@ Maybe<bool> RandomBytesTraits::AdditionalConfig(
5150
CHECK_GE(byte_offset + size, byte_offset); // Overflow check.
5251
CHECK_LE(byte_offset + size, in.size()); // Bounds check.
5352

54-
if (UNLIKELY(size > INT_MAX)) {
55-
THROW_ERR_OUT_OF_RANGE(env, "buffer is too large");
56-
return Nothing<bool>();
57-
}
58-
5953
params->buffer = in.data() + byte_offset;
6054
params->size = size;
6155

0 commit comments

Comments
 (0)