Skip to content

Commit

Permalink
tools: fix more build warnings in inspector_protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
richardlau committed Aug 10, 2021
1 parent 1c2c34a commit e79973c
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 e79973c

Please sign in to comment.