diff options
author | Adam Cozzette <acozzette@google.com> | 2016-11-17 16:48:38 -0800 |
---|---|---|
committer | Adam Cozzette <acozzette@google.com> | 2016-11-17 16:59:59 -0800 |
commit | 5a76e633ea9b5adb215e93fdc11e1c0c08b3fc74 (patch) | |
tree | 0276f81f8848a05d84cd7e287b43d665e30f04e3 /src/google/protobuf/arena_unittest.cc | |
parent | e28286fa05d8327fd6c5aa70cfb3be558f0932b8 (diff) | |
download | protobuf-5a76e633ea9b5adb215e93fdc11e1c0c08b3fc74.tar.gz protobuf-5a76e633ea9b5adb215e93fdc11e1c0c08b3fc74.tar.bz2 protobuf-5a76e633ea9b5adb215e93fdc11e1c0c08b3fc74.zip |
Integrated internal changes from Google
Diffstat (limited to 'src/google/protobuf/arena_unittest.cc')
-rw-r--r-- | src/google/protobuf/arena_unittest.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/google/protobuf/arena_unittest.cc b/src/google/protobuf/arena_unittest.cc index 35d00463..4f9571db 100644 --- a/src/google/protobuf/arena_unittest.cc +++ b/src/google/protobuf/arena_unittest.cc @@ -249,7 +249,7 @@ TEST(ArenaTest, Parsing) { arena_message->ParseFromString(original.SerializeAsString()); TestUtil::ExpectAllFieldsSet(*arena_message); - // Test that string fields have null terminator bytes (earlier bug). + // Test that string fields have nul terminator bytes (earlier bug). EXPECT_EQ(strlen(original.optional_string().c_str()), strlen(arena_message->optional_string().c_str())); } @@ -1154,6 +1154,13 @@ TEST(ArenaTest, NoHeapAllocationsTest) { arena.Reset(); } +TEST(ArenaTest, ParseCorruptedString) { + TestAllTypes message; + TestUtil::SetAllFields(&message); + TestParseCorruptedString<TestAllTypes, true>(message); + TestParseCorruptedString<TestAllTypes, false>(message); +} + #ifndef GOOGLE_PROTOBUF_NO_RTTI // Test construction on an arena via generic MessageLite interface. We should be // able to successfully deserialize on the arena without incurring heap |