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 <thiago.macieira@intel.com>
bb10
Marc Mutz 2022-04-11 16:30:12 +02:00
parent d99e8d96b6
commit 9c028b0ff4
1 changed files with 1 additions and 1 deletions

View File

@ -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)
{
}