From d76de8920f1983bf632df11e267920b9eb3f7857 Mon Sep 17 00:00:00 2001 From: Mark Voronin <116365722+overdeadsss@users.noreply.github.com> Date: Thu, 19 Mar 2026 04:16:00 +0300 Subject: [PATCH] qtbase: fix crash in QString::at on malformed unicode --- ...dd-bounds-check-to-qstring-accessors.patch | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 qtbase_5.15.18/0034-add-bounds-check-to-qstring-accessors.patch diff --git a/qtbase_5.15.18/0034-add-bounds-check-to-qstring-accessors.patch b/qtbase_5.15.18/0034-add-bounds-check-to-qstring-accessors.patch new file mode 100644 index 0000000..9d28c22 --- /dev/null +++ b/qtbase_5.15.18/0034-add-bounds-check-to-qstring-accessors.patch @@ -0,0 +1,28 @@ +diff --git a/src/corelib/text/qstring.h b/src/corelib/text/qstring.h +index 5bec5dffbe6..b40de24431a 100644 +--- a/src/corelib/text/qstring.h ++++ b/src/corelib/text/qstring.h +@@ -1066,11 +1066,20 @@ inline QString::QString(QLatin1String aLatin1) : d(fromLatin1_helper(aLatin1.lat + inline int QString::length() const + { return d->size; } + inline const QChar QString::at(int i) const +-{ Q_ASSERT(uint(i) < uint(size())); return QChar(d->data()[i]); } ++{ ++ if (uint(i) >= uint(size())) return QChar(); ++ return QChar(d->data()[i]); ++} + inline const QChar QString::operator[](int i) const +-{ Q_ASSERT(uint(i) < uint(size())); return QChar(d->data()[i]); } ++{ ++ if (uint(i) >= uint(size())) return QChar(); ++ return QChar(d->data()[i]); ++} + inline const QChar QString::operator[](uint i) const +-{ Q_ASSERT(i < uint(size())); return QChar(d->data()[i]); } ++{ ++ if (i >= uint(size())) return QChar(); ++ return QChar(d->data()[i]); ++} + inline bool QString::isEmpty() const + { return d->size == 0; } + inline const QChar *QString::unicode() const