Skip to content

Commit

Permalink
Treat kParseError logically kDirty.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 550564661
  • Loading branch information
protobuf-github-bot authored and copybara-github committed Jul 24, 2023
1 parent 004f54a commit 46ddd14
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/google/protobuf/message_unittest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,16 @@ TEST(MESSAGE_TEST_NAME, ExplicitLazyExceedRecursionLimit) {
EXPECT_NE(parsed.lazy_child().child().payload().optional_int32(), -1);
}

TEST(MESSAGE_TEST_NAME, UnparsedEmpty) {
// lazy_child, LEN=100 with no payload.
const char encoded[] = {'\042', 100};
UNITTEST::NestedTestAllTypes message;

EXPECT_FALSE(message.ParseFromArray(encoded, sizeof(encoded)));
EXPECT_TRUE(message.has_lazy_child());
EXPECT_EQ(message.lazy_child().ByteSizeLong(), 0);
}

TEST(MESSAGE_TEST_NAME, ParseFailNonCanonicalZeroTag) {
const char encoded[] = {"\n\x3\x80\0\0"};
UNITTEST::NestedTestAllTypes parsed;
Expand Down

0 comments on commit 46ddd14

Please sign in to comment.