mirror of
https://github.com/nodejs/node.git
synced 2026-11-30 11:55:44 -05:00
src: simplify bound check in ParseArrayIndex
PR-URL: https://github.com/nodejs/node/pull/42306 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
1 parent
9500e5862e
commit
8b84e68cbd
1 file changed
+1
-2
+1
-2
@@ -220,9 +220,8 @@ inline MUST_USE_RESULT Maybe<bool> ParseArrayIndex(Environment* env,
|
||||
return Just(false);
|
||||
|
||||
// Check that the result fits in a size_t.
|
||||
const uint64_t kSizeMax = static_cast<uint64_t>(static_cast<size_t>(-1));
|
||||
// coverity[pointless_expression]
|
||||
if (static_cast<uint64_t>(tmp_i) > kSizeMax)
|
||||
if (static_cast<uint64_t>(tmp_i) > std::numeric_limits<size_t>::max())
|
||||
return Just(false);
|
||||
|
||||
*ret = static_cast<size_t>(tmp_i);
|
||||
|
||||
Reference in new issue
Block a user