Details
-
Bug
-
Resolution: Done
-
P0: Blocker
-
6.2.2
-
None
-
-
8c5e31536a (qt/qtbase/dev) 8c5e31536a (qt/tqtc-qtbase/dev) bf02126e39 (qt/qtbase/6.2.3) bf02126e39 (qt/tqtc-qtbase/6.2.3) 9681c208d2 (qt/qtbase/6.3) 9681c208d2 (qt/tqtc-qtbase/6.3) 8bdfb47f8b (qt/qtbase/6.2) 8bdfb47f8b (qt/tqtc-qtbase/6.2)
-
Team Two Foundation Sprint 49
Description
The example below fails quickly:
#include <QCache> #include <QCoreApplication> #include <QRandomGenerator> #include <QUuid> int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); QList<QString> set1{ // hash 12997127560409977849 "https://msk-m10-itv01.svc.iptv.rt.ru/sdp/nc-poster1607682889889.jpg?width=246&height=357", "https://msk-m10-itv01.svc.iptv.rt.ru/sdp/nc-poster1607680491432.jpg?width=246&height=357"}; QList<QString> set2{ // hash 3776740375027953557 "https://msk-m10-itv01.svc.iptv.rt.ru/sdp/nc-poster1607690988464.jpg?width=246&height=357", "https://msk-m10-itv01.svc.iptv.rt.ru/sdp/nc-poster1607692568848.jpg?width=246&height=357", "https://msk-m10-itv01.svc.iptv.rt.ru/sdp/nc-poster1607690163139.jpg?width=246&height=357"}; QList<QString> set3{ // hash 9098347284464799501 "https://msk-m10-itv01.svc.iptv.rt.ru/sdp/nc-poster1598348229353.jpg?width=246&height=357", "https://msk-m10-itv01.svc.iptv.rt.ru/sdp/nc-poster15k98347394491.jpg?width=246&height=357", "https://msk-m10-itv01.svc.iptv.rt.ru/sdp/nc-poster1598347441419.jpg?width=246&height=357"}; QList<QString> set4{ // hash 12229382533688088545 "https://msk-m10-itv01.svc.iptv.rt.ru/sdp/nc-poster1564750010324.jpg?width=246&height=357", "https://msk-m10-itv01.svc.iptv.rt.ru/sdp/nc-poster1564753002916.jpg?width=246&height=357"}; QList<QString> set5{ // hash 4785817326207999282 "https://msk-m10-itv01.svc.iptv.rt.ru/sdp/nc-poster1548234017423.jpg?width=246&height=357", "https://msk-m10-itv01.svc.iptv.rt.ru/sdp/nc-poster1548233337244.jpg?width=246&height=357", "https://msk-m10-itv01.svc.iptv.rt.ru/sdp/nc-poster1548231760481.jpg?width=246&height=357", "https://msk-m10-itv01.svc.iptv.rt.ru/sdp/nc-poster1548232389457.jpg?width=246&height=357", "https://msk-m10-itv01.svc.iptv.rt.ru/sdp/nc-poster1548238548599.jpg?width=246&height=357"}; QList<QList<QString> *> sets{&set1, &set2, &set3, &set4, &set5}; QCache<QString, int> c; c.setMaxCost(1024 * 1024); for (;;) { const auto n = QRandomGenerator::global()->bounded(0, 5); const auto i = QRandomGenerator::global()->bounded(0, sets.at(n)->size()); const auto cost = QRandomGenerator::global()->bounded(1024, 32000); const auto &key = sets.at(n)->at(i); if (c.contains(key)) { const auto dummy = *c.object(key); Q_UNUSED(dummy) } else { c.insert(key, new int(0), cost); } c.insert(QUuid::createUuid().toString(), new int(0), QRandomGenerator::global()->bounded(1024, 32000)); } return a.exec(); }
Sets contain strings with the same hash value.
Attachments
Issue Links
- relates to
-
QTBUG-99224 Crash in QPixmapCache
- Closed
For Gerrit Dashboard: QTBUG-99710 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
389459,5 | QCache: fix potential crash in trim() | dev | qt/qtbase | Status: MERGED | +2 | 0 |
389601,2 | QCache: fix potential crash in trim() | 6.2.3 | qt/qtbase | Status: MERGED | +2 | 0 |
389797,2 | QCache: fix potential crash in trim() | 6.3 | qt/qtbase | Status: MERGED | +2 | 0 |
389798,2 | QCache: fix potential crash in trim() | 6.2 | qt/qtbase | Status: MERGED | +2 | 0 |