Details
-
Bug
-
Resolution: Done
-
P2: Important
-
6.2.0
-
None
-
-
333b40a12e82edb44ee472d7b95e533a99bb32d0 (qt/qtbase/dev) 5c5f6b453d35f2d10e1448ba5302fe1c705f2c35 (qt/qtbase/6.2)
Description
Run the following example:
#include <QDebug> #include <QFile> #include <QTextCodec> int main(int argc, char *argv[]) { QTextCodec *codec = QTextCodec::codecForName("UTF-32"); if (!codec) { qDebug() << "Could not find codec for UTF-32"; return 0; } QFile file("dialog.ui"); if (!file.open(QIODevice::ReadOnly)) { qDebug() << "Can't open input file."; return 0; } const QByteArray data = file.readAll(); file.close(); qDebug() << "About to transform"; const QString str = codec->toUnicode(data); const QByteArray newData = codec->fromUnicode(str); qDebug() << "All went fine"; return 0; }
and place the attached dialog.ui in the executable directory. It aborts on a call to fromUnicode() with the following message:
ASSERT: "end - ba.constData() == length" in file /home/jarek/dev/qt-62/qtbase/src/corelib/text/qstringconverter.cpp, line 1030
Please note that the dialog.ui file has some strange encoding (file taken from QTCREATORBUG-26028 task). This code is running fine with Qt 5.15.
Most probably the issue was introduced in b1d8ce32cd4dc7dc021aa9f0c05048753f04dd6c
Attachments
Issue Links
- resulted from
-
QTCREATORBUG-26366 Crash when trying to select encoding
- Closed
For Gerrit Dashboard: QTBUG-97122 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
375285,3 | QUtf32: fix bad assertion in convertFromUnicode | dev | qt/qtbase | Status: MERGED | +2 | 0 |
375432,5 | Add QTextCodec test that triggers an assertion in QUtf32 | dev | qt/qt5compat | Status: MERGED | +2 | 0 |
376196,2 | QUtf32: fix bad assertion in convertFromUnicode | 6.2 | qt/qtbase | Status: MERGED | +2 | 0 |
376197,1 | QUtf32: fix bad assertion in convertFromUnicode | 6.1 | qt/qtbase | Status: ABANDONED | +2 | 0 |
376596,2 | Add QTextCodec test that triggers an assertion in QUtf32 | 6.2 | qt/qt5compat | Status: MERGED | +2 | 0 |