Skip to content

Commit afcfaa0

Browse files
authored
src: simplify bound check in ParseArrayIndex
PR-URL: #42306 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent d90ceb2 commit afcfaa0

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/node_buffer.cc

+1-2
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)