Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTobias Nießen <tniessen@tnie.de>2022-03-14 19:36:39 +0300
committerGitHub <noreply@github.com>2022-03-14 19:36:39 +0300
commitafcfaa07ace59f7650767d04153e8e288dc6edc4 (patch)
tree8eaa75dcf469456c6bdf2e6c7d8b61488adc6998 /src
parentd90ceb2b54a025a98b9cbf18f2403154d356a0c7 (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/node_buffer.cc3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/node_buffer.cc b/src/node_buffer.cc
index be9324a8bd8..215bd8003aa 100644
--- a/src/node_buffer.cc
+++ b/src/node_buffer.cc
@@ -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);