diff options
author | Tobias Nießen <tniessen@tnie.de> | 2022-03-14 19:36:39 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-14 19:36:39 +0300 |
commit | afcfaa07ace59f7650767d04153e8e288dc6edc4 (patch) | |
tree | 8eaa75dcf469456c6bdf2e6c7d8b61488adc6998 /src | |
parent | d90ceb2b54a025a98b9cbf18f2403154d356a0c7 (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.cc | 3 |
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); |