Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Unified Diff: base/pickle_unittest.cc

Issue 6353010: Check that we've got a complete header before accessing its fields. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/pickle.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/pickle_unittest.cc
===================================================================
--- base/pickle_unittest.cc (revision 72619)
+++ base/pickle_unittest.cc (working copy)
@@ -171,6 +171,17 @@
EXPECT_TRUE(end == Pickle::FindNext(pickle.header_size_, start, end + 1));
}
+TEST(PickleTest, FindNextWithIncompleteHeader) {
+ size_t header_size = sizeof(Pickle::Header);
+ scoped_array<char> buffer(new char[header_size - 1]);
+ memset(buffer.get(), 0x1, header_size - 1);
+
+ const char* start = buffer.get();
+ const char* end = start + header_size - 1;
+
+ EXPECT_TRUE(NULL == Pickle::FindNext(header_size, start, end));
+}
+
TEST(PickleTest, IteratorHasRoom) {
Pickle pickle;
EXPECT_TRUE(pickle.WriteInt(1));
« no previous file with comments | « base/pickle.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698