Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
6.2.2
-
None
-
Qt 6.2.2, Windows 11, Msvc 2019 64 bits
-
-
bb35b2f64d (qt/qtbase/dev) bb35b2f64d (qt/tqtc-qtbase/dev) c411ab3014 (qt/qtbase/6.2) a457e92451 (qt/qtbase/6.3) c411ab3014 (qt/tqtc-qtbase/6.2) a457e92451 (qt/tqtc-qtbase/6.3) a457e92451 (qt/tqtc-qtbase/6.3.0)
Description
Despite the documentation says, QByteArray::append(const char *str, qsizetype len) crashes if len < 0.
The Qt 6.2.2 QByteArray source code is
QByteArray &append(const char *s, qsizetype len) { return append(QByteArrayView(s, len)); }
but:
template <typename Byte, if_compatible_byte<Byte> = true> constexpr QByteArrayView(const Byte *data, qsizetype len) : m_size((Q_ASSERT(len >= 0), Q_ASSERT(data || !len), len)), m_data(castHelper(data)) {}
So the application terminates with the Q_ASSERT(len >= 0).
The same code has been working without problem from Qt 5.0 to Qt 5.15.