Skip to content

Commit 1c2c34a

Browse files
RaisinTenrichardlau
authored andcommitted
tools: cherry-pick ffb34b6
Original commit message: tools: fix compiler warning in inspector_protocol error: comparison of integer expressions of different signedness: ‘int’ and ‘uint64_t’ {aka ‘long unsigned int’} [-Werror=sign-compare] 2562 | if (!success || std::numeric_limits<int32_t>::max() < | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ 2563 | token_start_internal_value_) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ PR-URL: nodejs#37573 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
1 parent a1fac5b commit 1c2c34a

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

tools/inspector_protocol/encoding/encoding.cc

+3-2
Original file line numberDiff line numberDiff line change
@@ -831,8 +831,9 @@ void CBORTokenizer::ReadNextToken(bool enter_envelope) {
831831
// inspector_protocol, it's not a CBOR limitation), so we check
832832
// against the signed max, so that the allowable values are
833833
// 0, 1, 2, ... 2^31 - 1.
834-
if (!bytes_read || std::numeric_limits<int32_t>::max() <
835-
token_start_internal_value_) {
834+
if (!bytes_read ||
835+
static_cast<int64_t>(std::numeric_limits<int32_t>::max()) <
836+
static_cast<int64_t>(token_start_internal_value_)) {
836837
SetError(Error::CBOR_INVALID_INT32);
837838
return;
838839
}

tools/inspector_protocol/lib/encoding_cpp.template

+3-2
Original file line numberDiff line numberDiff line change
@@ -839,8 +839,9 @@ void CBORTokenizer::ReadNextToken(bool enter_envelope) {
839839
// inspector_protocol, it's not a CBOR limitation), so we check
840840
// against the signed max, so that the allowable values are
841841
// 0, 1, 2, ... 2^31 - 1.
842-
if (!bytes_read || std::numeric_limits<int32_t>::max() <
843-
token_start_internal_value_) {
842+
if (!bytes_read ||
843+
static_cast<int64_t>(std::numeric_limits<int32_t>::max()) <
844+
static_cast<int64_t>(token_start_internal_value_)) {
844845
SetError(Error::CBOR_INVALID_INT32);
845846
return;
846847
}

0 commit comments

Comments
 (0)