From 4c08f71a11d35bcf263967f95797022ba944f9a4 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 20 Jul 2022 22:16:30 +0200 Subject: [PATCH] Fix QString::arg() for format strings > 2Gi characters The getEscape function truncated the qsizetype position it got from the caller to an int, potentially parsing a previous escape sequence (or, more likely, garbage), by getting the position in the string wrong. Task-number: QTBUG-103531 Change-Id: I3b921c0991d238bbacfe6699c56146fe032134df Reviewed-by: Thiago Macieira Reviewed-by: Edward Welbourne (cherry picked from commit 841ff3b73f9951e49b6406007d76302b3f367f55) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/text/qstring.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp index 55500bc526e..4ae5eb10603 100644 --- a/src/corelib/text/qstring.cpp +++ b/src/corelib/text/qstring.cpp @@ -8508,7 +8508,7 @@ static inline char16_t to_unicode(const char c) { return QLatin1Char{c}.unicode( template static int getEscape(const Char *uc, qsizetype *pos, qsizetype len, int maxNumber = 999) { - int i = *pos; + qsizetype i = *pos; ++i; if (i < len && uc[i] == u'L') ++i;