From 0d69de55c32d62f0db579d3d78115375455a1e19 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 20 Jul 2022 22:01:38 +0200 Subject: [PATCH] Fix QString::toLatin1() for strings > 16Gi characters on ARM64 More qsizetype truncation to int, this time in the number of chunks in SIMD processing, so the limit isn't 2Gi, but 16Gi. Task-number: QTBUG-103531 Change-Id: Ib584c8dc7aa8dedc1cb8181e7d6f20b582c93f8c Reviewed-by: Thiago Macieira Reviewed-by: Edward Welbourne (cherry picked from commit 0b5d4c3eae8cd8024bc6e1df6321e2ad5deabb76) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/text/qstring.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp index 2507802b6ba..aa979981aff 100644 --- a/src/corelib/text/qstring.cpp +++ b/src/corelib/text/qstring.cpp @@ -950,10 +950,10 @@ static void qt_to_latin1_internal(uchar *dst, const char16_t *src, qsizetype len // 1) neon has unsigned comparison // 2) packing is done to 64 bits (8 x 8bits component). if (length >= 16) { - const int chunkCount = length >> 3; // divided by 8 + const qsizetype chunkCount = length >> 3; // divided by 8 const uint16x8_t questionMark = vdupq_n_u16('?'); // set const uint16x8_t thresholdMask = vdupq_n_u16(0xff); // set - for (int i = 0; i < chunkCount; ++i) { + for (qsizetype i = 0; i < chunkCount; ++i) { uint16x8_t chunk = vld1q_u16((uint16_t *)src); // load src += 8;