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 8b84e68

Browse filesBrowse files
tniessenbengl
authored andcommitted
src: simplify bound check in ParseArrayIndex
PR-URL: #42306 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 9500e58 commit 8b84e68
Copy full SHA for 8b84e68

File tree

Expand file treeCollapse file tree

1 file changed

+1
-2
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+1
-2
lines changed
Open diff view settings
Collapse file

‎src/node_buffer.cc‎

Copy file name to clipboardExpand all lines: src/node_buffer.cc
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,8 @@ inline MUST_USE_RESULT Maybe<bool> ParseArrayIndex(Environment* env,
220220
return Just(false);
221221

222222
// Check that the result fits in a size_t.
223-
const uint64_t kSizeMax = static_cast<uint64_t>(static_cast<size_t>(-1));
224223
// coverity[pointless_expression]
225-
if (static_cast<uint64_t>(tmp_i) > kSizeMax)
224+
if (static_cast<uint64_t>(tmp_i) > std::numeric_limits<size_t>::max())
226225
return Just(false);
227226

228227
*ret = static_cast<size_t>(tmp_i);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.