Details
-
Bug
-
Resolution: Fixed
-
P1: Critical
-
6.8.1, 6.8.2
-
None
-
Windows 11
-
-
54daec43a (dev), 8e94b67ba (6.9), d4a90a3f3 (6.8)
Description
In debug mode, I get an assertion failure when inserting valid data into a QJsonObject object.
The message error is
ASSERT: "lhs.size() == rhs.size()" in file C:\Users\qt\work\qt\qtbase\src\corelib\text\qstring.cpp. line 1395
This is reproducible with these 3 lines of code and only if UTF-16 character is used for the JSON object key and if the second key is prior to the first one in alphabetical order.
QJsonObject myObject; myObject.insert("k♭", "First key"); // key should contain UTF-16 character myObject.insert("a", "Second key"); // second key should be prior to first key in alphabetical order
I checked the code and usually the size of lhs and rhs is checked before calling the function QtPrivate::equalStrings(QStringView lhs, QStringView rhs) (for example in comparesEqual function in file qstring.h at line 799)
But this is not the case in function stringCompareElement(const QtCbor::Element &e, String s, QtCbor::Comparison mode) in file qcborvalue_p.h:365.
Attachments
For Gerrit Dashboard: QTBUG-133744 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
624327,2 | CBOR/JSON: fix crash when comparing strings with different length | dev | qt/qtbase | Status: MERGED | +2 | 0 |
624548,5 | CBOR/JSON: fix crash when comparing strings with different length | 6.9 | qt/qtbase | Status: MERGED | +2 | +1 |
630289,2 | CBOR/JSON: fix crash when comparing strings with different length | 6.8 | qt/qtbase | Status: MERGED | +2 | 0 |