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

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: Second attempt 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..a7f8364e0ca1b8a9fc5b5870d326b5fd2d69544a 100644
--- a/Source/wtf/text/StringImpl.cpp
+++ b/Source/wtf/text/StringImpl.cpp
@@ -689,13 +689,15 @@ 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);
+ ASSERT(targetLength <= length);
tkent 2014/11/25 00:41:22 This assertion is not correct. input: ß (length=
+ 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