diff options
author | Brian Salomon <bsalomon@google.com> | 2018-04-25 12:58:23 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-04-25 20:58:09 +0000 |
commit | 43227522e494d02011eb541789bb652065349658 (patch) | |
tree | 4410cdec6c02538c8d12edd96e375d7b97d80121 /tests | |
parent | abc1976c12e7fdcc59df578712d3ad9cf74f8f48 (diff) |
Make SkString::appendf safe for long strings.
Bug: skia:7841
Change-Id: I5bc77f5230b63da74e42d756ab4a1fefcfab9926
Reviewed-on: https://skia-review.googlesource.com/123634
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/StringTest.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/StringTest.cpp b/tests/StringTest.cpp index 06c18f6f53..f8c319e9be 100644 --- a/tests/StringTest.cpp +++ b/tests/StringTest.cpp @@ -192,7 +192,15 @@ DEF_TEST(String, reporter) { REPORTER_ASSERT(reporter, a.size() == 2000); for (size_t i = 0; i < a.size(); ++i) { if (a[i] != ' ') { - ERRORF(reporter, "SkStringPrintf fail: a[%d] = '%c'", i, a[i]); + ERRORF(reporter, "SkString::printf fail: a[%d] = '%c'", i, a[i]); + break; + } + } + a.appendf("%2000s", " "); + REPORTER_ASSERT(reporter, a.size() == 4000); + for (size_t i = 0; i < a.size(); ++i) { + if (a[i] != ' ') { + ERRORF(reporter, "SkString::appendf fail: a[%d] = '%c'", i, a[i]); break; } } |