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 e2292f9

Browse filesBrowse 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
Copy full SHA for e2292f9

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

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

‎src/crypto/crypto_random.cc‎

Copy file name to clipboardExpand all lines: src/crypto/crypto_random.cc
-6Lines changed: 0 additions & 6 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.