aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar scroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-07-23 13:44:10 +0000
committerGravatar scroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-07-23 13:44:10 +0000
commite9617eb352483bf152dfd3a38083ffb99c4694b9 (patch)
tree4aea8dce2333193735b0d842d3cc18bdacb26745 /tests
parentbfeddae9da240693441556b2f278827e213f75e8 (diff)
In SkWriter32::writeString, initialize all memory reserved.
SkFlatData compares data which is sometimes created by writeString. Initialize all the memory in writeString so it does not compare uninitialized memory. See http://code.google.com/p/skia/issues/detail?id=721&thanks=721 Review URL: https://codereview.appspot.com/6428054 git-svn-id: http://skia.googlecode.com/svn/trunk@4715 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests')
-rw-r--r--tests/Writer32Test.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/Writer32Test.cpp b/tests/Writer32Test.cpp
index 311f37d8fb..5c9d7ea58c 100644
--- a/tests/Writer32Test.cpp
+++ b/tests/Writer32Test.cpp
@@ -77,6 +77,11 @@ static void test2(skiatest::Reporter* reporter, SkWriter32* writer) {
REPORTER_ASSERT(reporter, i == len);
REPORTER_ASSERT(reporter, strlen(str) == len);
REPORTER_ASSERT(reporter, !memcmp(str, gStr, len));
+ // Ensure that the align4 of the string is padded with zeroes.
+ size_t alignedSize = SkAlign4(len + 1);
+ for (size_t j = len; j < alignedSize; j++) {
+ REPORTER_ASSERT(reporter, 0 == str[j]);
+ }
}
REPORTER_ASSERT(reporter, reader.eof());
}