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 targos committed Sep 4, 2021
1 parent 09630cf commit a338c0e
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 a338c0e

Please sign in to comment.