From 2ccf4c32cc593f568581dd237e1e27d39fd965a2 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 7 Jun 2013 18:39:12 -0700 Subject: QUrl stringprep: recalculate the current position if the size changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the case folding operation results in either expansion or reduction of the string, we need to adapt. Reduction happens most often when a non-BMP character is case-folded to a character in the BMP (example: mathematical signs at U+1D400-1D7FF). Expansion happens in the rare case of symbols containing words, like U+2121 ℡ (this is part of the unit test), and one common case: the German sharp S (ß) is expanded to "ss". Change-Id: I1bdbdc908b958a89bf30e4bb648d65dfdd9097f8 Reviewed-by: Konstantin Ritt --- src/corelib/io/qurlidna.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/corelib/io/qurlidna.cpp') diff --git a/src/corelib/io/qurlidna.cpp b/src/corelib/io/qurlidna.cpp index fac1703da8..7478099e9e 100644 --- a/src/corelib/io/qurlidna.cpp +++ b/src/corelib/io/qurlidna.cpp @@ -1472,7 +1472,8 @@ static void mapToLowerCase(QString *str, int from) if (uc <= 0xffff) str->replace(i, 1, reinterpret_cast(&entry->mapping[0]), l); else - str->replace(i-1, 2, reinterpret_cast(&entry->mapping[0]), l); + str->replace(--i, 2, reinterpret_cast(&entry->mapping[0]), l); + i += l - 1; d = 0; } else { if (!d) -- cgit v1.2.3