From f4f910501d68116db6e406a45c3bfc50510b2d23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= Date: Sat, 12 Mar 2022 01:02:47 +0000 Subject: [PATCH] src: simplify bound check in ParseArrayIndex --- src/node_buffer.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/node_buffer.cc b/src/node_buffer.cc index be9324a8bd82ab..215bd8003aabe1 100644 --- a/src/node_buffer.cc +++ b/src/node_buffer.cc @@ -220,9 +220,8 @@ inline MUST_USE_RESULT Maybe ParseArrayIndex(Environment* env, return Just(false); // Check that the result fits in a size_t. - const uint64_t kSizeMax = static_cast(static_cast(-1)); // coverity[pointless_expression] - if (static_cast(tmp_i) > kSizeMax) + if (static_cast(tmp_i) > std::numeric_limits::max()) return Just(false); *ret = static_cast(tmp_i);