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 <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 841ff3b73f9951e49b6406007d76302b3f367f55)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2022-07-20 22:16:30 +02:00 committed by Qt Cherry-pick Bot
parent cf89e21bde
commit 4c08f71a11

View File

@ -8508,7 +8508,7 @@ static inline char16_t to_unicode(const char c) { return QLatin1Char{c}.unicode(
template <typename Char>
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;