From 889d521d8715f4934accb630097bc09bf7ad1a32 Mon Sep 17 00:00:00 2001 From: Mike Reed Date: Thu, 21 Dec 2017 13:34:24 -0500 Subject: validate text during deserialization Bug: 796473 Change-Id: I7b6a6c698a5b53c915ef6564852fa51ce7410a3e Reviewed-on: https://skia-review.googlesource.com/88520 Commit-Queue: Mike Reed Reviewed-by: Hal Canary --- tests/UtilsTest.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/UtilsTest.cpp') diff --git a/tests/UtilsTest.cpp b/tests/UtilsTest.cpp index ed861c69a0..7e11f8478a 100644 --- a/tests/UtilsTest.cpp +++ b/tests/UtilsTest.cpp @@ -174,7 +174,7 @@ static void test_utf16(skiatest::Reporter* reporter) { for (size_t i = 0; i < SK_ARRAY_COUNT(gUni); i++) { size_t count = SkUTF16_FromUnichar(gUni[i], buf); REPORTER_ASSERT(reporter, count == 2); - size_t count2 = SkUTF16_CountUnichars(buf, 2); + size_t count2 = SkUTF16_CountUnichars(buf, 2 * sizeof(uint16_t)); REPORTER_ASSERT(reporter, count2 == 1); const uint16_t* ptr = buf; SkUnichar c = SkUTF16_NextUnichar(&ptr); @@ -227,7 +227,7 @@ DEF_TEST(Utils, reporter) { #define LEADING_FOUR_BYTE "\xF0" #define INVALID_BYTE "\xFC" static bool valid_utf8(const char* p, size_t l) { - return SkUTF8_CountUnicharsWithError(p, l) >= 0; + return SkUTF8_CountUnichars(p, l) >= 0; } DEF_TEST(Utils_UTF8_ValidLength, r) { const char* goodTestcases[] = { -- cgit v1.2.3