From 431d50821669bd49b91eb1ac3c66417c0f4e5c59 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 20 Jul 2022 22:43:20 +0200 Subject: [PATCH] Fix stringish::simplified() for strings > 2Gi characters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If, after simplification, the result string would have been >2Gi characters in length, the code returned a shorter string, truncated mod INT_MAX, because the algorithm had not been ported to qsizetype. Task-number: QTBUG-103531 Change-Id: I57cfed34e5c69406f8d3f2913962d006b4bc6bd0 Reviewed-by: Thiago Macieira Reviewed-by: Edward Welbourne Reviewed-by: MÃ¥rten Nordheim (cherry picked from commit ec35efd7f2cea4dcbe0188f0d44cde541803f53e) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/text/qstringalgorithms_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/text/qstringalgorithms_p.h b/src/corelib/text/qstringalgorithms_p.h index 527707b8e75..513e2b8cbc3 100644 --- a/src/corelib/text/qstringalgorithms_p.h +++ b/src/corelib/text/qstringalgorithms_p.h @@ -101,7 +101,7 @@ template struct QStringAlgorithms if (ptr != dst && ptr[-1] == QChar::Space) --ptr; - int newlen = ptr - dst; + qsizetype newlen = ptr - dst; if (isConst && newlen == str.size() && unmodified) { // nothing happened, return the original return str;