Skip to content

Commit

Permalink
tools: update inspector_protocol to fe0467fd105a
Browse files Browse the repository at this point in the history
Refs: https://chromium.googlesource.com/deps/inspector_protocol/+log

PR-URL: #39694
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
Trott authored and targos committed Sep 4, 2021
1 parent df1e20a commit ad39687
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions tools/inspector_protocol/lib/encoding_cpp.template
Original file line number Diff line number Diff line change
Expand Up @@ -850,14 +850,15 @@ void CBORTokenizer::ReadNextToken(bool enter_envelope) {
return;
case MajorType::NEGATIVE: { // INT32.
// INT32 is a signed int32 (int32 makes sense for the
// inspector_protocol, it's not a CBOR limitation); in CBOR,
// the negative values for INT32 are represented as NEGATIVE,
// that is, -1 INT32 is represented as 1 << 5 | 0 (major type 1,
// additional info value 0). So here, we compute the INT32 value
// and then check it against the INT32 min.
int64_t actual_value =
-static_cast<int64_t>(token_start_internal_value_) - 1;
if (!success || actual_value < std::numeric_limits<int32_t>::min()) {
// inspector_protocol, it's not a CBOR limitation); in CBOR, the
// negative values for INT32 are represented as NEGATIVE, that is, -1
// INT32 is represented as 1 << 5 | 0 (major type 1, additional info
// value 0). The minimal allowed INT32 value in our protocol is
// std::numeric_limits<int32_t>::min(). We check for it by directly
// checking the payload against the maximal allowed signed (!) int32
// value.
if (!success || token_start_internal_value_ >
std::numeric_limits<int32_t>::max()) {
SetError(Error::CBOR_INVALID_INT32);
return;
}
Expand Down Expand Up @@ -1864,7 +1865,7 @@ class JsonParser {
// If the |Char| we're dealing with is really a byte, then
// we have utf8 here, and we need to check for multibyte characters
// and transcode them to utf16 (either one or two utf16 chars).
if (sizeof(Char) == sizeof(uint8_t) && c >= 0x7f) {
if (sizeof(Char) == sizeof(uint8_t) && c > 0x7f) {
// Inspect the leading byte to figure out how long the utf8
// byte sequence is; while doing this initialize |codepoint|
// with the first few bits.
Expand Down Expand Up @@ -1903,7 +1904,7 @@ class JsonParser {
// Disallow overlong encodings for ascii characters, as these
// would include " and other characters significant to JSON
// string termination / control.
if (codepoint < 0x7f)
if (codepoint <= 0x7f)
return false;
// Invalid in UTF8, and can't be represented in UTF16 anyway.
if (codepoint > 0x10ffff)
Expand Down

0 comments on commit ad39687

Please sign in to comment.