Skip to content

Commit

Permalink
tools: fix more build warnings in inspector_protocol
Browse files Browse the repository at this point in the history
PR-URL: #39725
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
richardlau authored and danielleadams committed Aug 16, 2021
1 parent 77f9c1f commit 52a172f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions tools/inspector_protocol/encoding/encoding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -850,8 +850,9 @@ void CBORTokenizer::ReadNextToken(bool enter_envelope) {
// We check the the payload in token_start_internal_value_ against
// that range (2^31-1 is also known as
// std::numeric_limits<int32_t>::max()).
if (!bytes_read || token_start_internal_value_ >
std::numeric_limits<int32_t>::max()) {
if (!bytes_read ||
static_cast<int64_t>(token_start_internal_value_) >
static_cast<int64_t>(std::numeric_limits<int32_t>::max())) {
SetError(Error::CBOR_INVALID_INT32);
return;
}
Expand Down
5 changes: 3 additions & 2 deletions tools/inspector_protocol/lib/encoding_cpp.template
Original file line number Diff line number Diff line change
Expand Up @@ -858,8 +858,9 @@ void CBORTokenizer::ReadNextToken(bool enter_envelope) {
// We check the the payload in token_start_internal_value_ against
// that range (2^31-1 is also known as
// std::numeric_limits<int32_t>::max()).
if (!bytes_read || token_start_internal_value_ >
std::numeric_limits<int32_t>::max()) {
if (!bytes_read ||
static_cast<int64_t>(token_start_internal_value_) >
static_cast<int64_t>(std::numeric_limits<int32_t>::max())) {
SetError(Error::CBOR_INVALID_INT32);
return;
}
Expand Down

0 comments on commit 52a172f

Please sign in to comment.