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

Unified Diff: Source/wtf/text/StringImpl.cpp

Issue 729173003: The caseConvert function should not truncate strings with zero length. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove assert Created 6 years, 1 month 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 | « LayoutTests/fast/html/empty-q-crash-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/text/StringImpl.cpp
diff --git a/Source/wtf/text/StringImpl.cpp b/Source/wtf/text/StringImpl.cpp
index fcb64d3f0505a8059f53faaa5355323b1c01d7d5..7ce7ace334ed4b12c2405189eb191b03d29a0edd 100644
--- a/Source/wtf/text/StringImpl.cpp
+++ b/Source/wtf/text/StringImpl.cpp
@@ -689,13 +689,14 @@ typedef int32_t (*icuCaseConverter)(UChar*, int32_t, const UChar*, int32_t, cons
static PassRefPtr<StringImpl> caseConvert(const UChar* source16, size_t length, icuCaseConverter converter, const char* locale, StringImpl* originalString)
{
UChar* data16;
- int32_t targetLength = length;
+ size_t targetLength = length;
RefPtr<StringImpl> output = StringImpl::createUninitialized(length, data16);
do {
UErrorCode status = U_ZERO_ERROR;
targetLength = converter(data16, targetLength, source16, length, locale, &status);
if (U_SUCCESS(status)) {
- output->truncateAssumingIsolated(targetLength);
+ if (length > 0)
+ output->truncateAssumingIsolated(targetLength);
return output.release();
}
if (status != U_BUFFER_OVERFLOW_ERROR)
« no previous file with comments | « LayoutTests/fast/html/empty-q-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698