Fix false negative in the verifier where it was accepting a non-canonical zero

field number.

PiperOrigin-RevId: 513652171
pull/12125/head
Protobuf Team Bot 2 years ago committed by Copybara-Service
parent 0a9282b82b
commit ac8725ce21
  1. 7
      src/google/protobuf/message_unittest.inc

@ -333,6 +333,13 @@ TEST(MESSAGE_TEST_NAME, ParseFailNonCanonicalZeroTag) {
absl::string_view{encoded, sizeof(encoded) - 1}));
}
TEST(MESSAGE_TEST_NAME, ParseFailNonCanonicalZeroField) {
const char encoded[] = {"\012\x6\205\0\0\0\0\0"};
UNITTEST::NestedTestAllTypes parsed;
EXPECT_FALSE(parsed.ParsePartialFromString(
absl::string_view{encoded, sizeof(encoded) - 1}));
}
TEST(MESSAGE_TEST_NAME, NestedExplicitLazyExceedRecursionLimit) {
UNITTEST::NestedTestAllTypes original, parsed;
// Build proto with recursion depth of 5, with nested annotated LazyField.

Loading…
Cancel
Save