Checking structure sizes before reading them from memory to avoid overflowing the buffer's stream.
BUG=
R=reed@google.com
Committed: https://code.google.com/p/skia/source/detail?r=12114
Review URL: https://codereview.chromium.org/41253002
git-svn-id: http://skia.googlecode.com/svn/trunk@12119 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp
index d879ea6..f6c2a7a 100644
--- a/tests/PathTest.cpp
+++ b/tests/PathTest.cpp
@@ -1808,12 +1808,12 @@
// create a buffer that should be much larger than the path so we don't
// kill our stack if writer goes too far.
char buffer[1024];
- uint32_t size1 = p.writeToMemory(NULL);
- uint32_t size2 = p.writeToMemory(buffer);
+ size_t size1 = p.writeToMemory(NULL);
+ size_t size2 = p.writeToMemory(buffer);
REPORTER_ASSERT(reporter, size1 == size2);
SkPath p2;
- uint32_t size3 = p2.readFromMemory(buffer);
+ size_t size3 = p2.readFromMemory(buffer, 1024);
REPORTER_ASSERT(reporter, size1 == size3);
REPORTER_ASSERT(reporter, p == p2);