Details
-
Suggestion
-
Resolution: Invalid
-
Not Evaluated
-
None
-
4.8.0
-
None
-
Windows, Linux... 32 and 64
Description
Currently the assertion is:
Q_ASSERT(uint < uint(size()))
With this the '\0' cannot retrieved with at() or []
will be good to change this to:
Q_ASSERT(uint <= uint(size()))
Ex:
QString echoChar(QChar c)
QString test("01234"); // size() == 5
qDebug() << "test[0]: " << echoChar(test[0]); // output: test[0]: "0"
qDebug() << "test[1]: " << echoChar(test[1]); // output: test[1]: "1"
qDebug() << "test[2]: " << echoChar(test[2]); // output: test[2]: "4"
qDebug() << "test[5]: " << echoChar(test[5]); // expected output: test[5]: "NUL",
but here the assertion will be fired!
I fink that code are 'copied' from QByteArray that doen't have null terminate char.