Discard remaining tag but check against non canonical encoding.

PiperOrigin-RevId: 510197783
pull/11973/head
Protobuf Team Bot 2 years ago committed by Copybara-Service
parent c4481302f0
commit eaf4e268fa
  1. 7
      src/google/protobuf/message_unittest.inc

@ -324,6 +324,13 @@ TEST(MESSAGE_TEST_NAME, ExplicitLazyExceedRecursionLimit) {
EXPECT_NE(parsed.lazy_child().child().payload().optional_int32(), -1); EXPECT_NE(parsed.lazy_child().child().payload().optional_int32(), -1);
} }
TEST(MESSAGE_TEST_NAME, ParseFailNonCanonicalZeroTag) {
const char encoded[] = {"\n\x3\x80\0\0"};
UNITTEST::NestedTestAllTypes parsed;
EXPECT_FALSE(parsed.ParsePartialFromString(
absl::string_view{encoded, sizeof(encoded) - 1}));
}
TEST(MESSAGE_TEST_NAME, NestedExplicitLazyExceedRecursionLimit) { TEST(MESSAGE_TEST_NAME, NestedExplicitLazyExceedRecursionLimit) {
UNITTEST::NestedTestAllTypes original, parsed; UNITTEST::NestedTestAllTypes original, parsed;
// Build proto with recursion depth of 5, with nested annotated LazyField. // Build proto with recursion depth of 5, with nested annotated LazyField.

Loading…
Cancel
Save