From 9c028b0ff4e684d9bb27df7171575a618e892267 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 11 Apr 2022 16:30:12 +0200 Subject: [PATCH] XmlStringRef: fix length truncation The XmlStringRef(const QString*) ctor calls the (const QString *, int, int) ctor, passing QString::length() as the third argument. If the input QString had more than 2 Gi characters, the resulting XmlStringRef represents only the prefix of the input (mod (INT_MAX+1)). Fix by making the delegatee ctor use qsizetype instead of int, allowing to pass data through without truncation. [ChangeLog][QtCore][QXmlStreamReader] Fixed several bugs regarding handling of documents larger than 2Gi characters on 64-bit platforms. Pick-to: 6.3 6.2 Fixes: QTBUG-102466 Change-Id: Ie48274190ac359f62d3ec3d8fe60eb43cc2c362a Reviewed-by: Thiago Macieira --- src/corelib/serialization/qxmlstream_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/serialization/qxmlstream_p.h b/src/corelib/serialization/qxmlstream_p.h index 30f824b312..f87006c7db 100644 --- a/src/corelib/serialization/qxmlstream_p.h +++ b/src/corelib/serialization/qxmlstream_p.h @@ -73,7 +73,7 @@ public: qsizetype m_size = 0; constexpr XmlStringRef() = default; - constexpr inline XmlStringRef(const QString *string, int pos, int length) + constexpr inline XmlStringRef(const QString *string, qsizetype pos, qsizetype length) : m_string(string), m_pos(pos), m_size(length) { }