Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
5.15.14, 6.5.2
-
65dbc006c (dev), 505c50ce8 (6.6), 3a75706a6 (tqtc/lts-6.5), 235c9db59 (tqtc/lts-6.2), 2000c8f19 (tqtc/lts-5.15)
Description
In some cases the Replica which is listening the Source can crash with QHostAddress being called with a "<null reference>".
The situation, when this occurs, is a device running the Source is rebooted which makes the Replica crash.
When the Client application (Replica) is run in debug mode. the source of the crash is shown in the debugger as the assignment operator overload for QHostAddress being called with a "<null reference>" for the address argument in file qhostaddress.cpp:522.
The proposed fix for the issue is to protect the null adresses in qtconnection_tcpip_backend.cpp file. in Qt/<qt_version>/Src/qtremoteobjects/src/remoteobjects/
void TcpClientIo::connectToServer() { if (isOpen()) return; QHostAddress address(url().host()); if (address.isNull()) { const QList<QHostAddress> addresses = QHostInfo::fromName(url().host()).addresses(); Q_ASSERT_X(addresses.size() >= 1, Q_FUNC_INFO, url().toString().toLatin1().data()); if(addresses.size() > 0){ // <- protection for null addresses address = addresses.first(); } } if(!address.isNull()){ m_socket->connectToHost(address, url().port()); }
Attachments
For Gerrit Dashboard: QTBUG-116151 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
516796,3 | Fix a crash due to null QHostAddress in the TCP/IP backend | dev | qt/qtremoteobjects | Status: MERGED | -1 | 0 |
517575,2 | Fix a crash due to null QHostAddress in the TCP/IP backend | 6.6 | qt/qtremoteobjects | Status: MERGED | +2 | 0 |
517589,2 | Fix a crash due to null QHostAddress in the TCP/IP backend | tqtc/lts-6.5 | qt/tqtc-qtremoteobjects | Status: MERGED | +2 | 0 |
517653,2 | Fix a crash due to null QHostAddress in the TCP/IP backend | tqtc/lts-6.2 | qt/tqtc-qtremoteobjects | Status: MERGED | +2 | 0 |
517667,4 | Fix a crash due to null QHostAddress in the TCP/IP backend | tqtc/lts-5.15 | qt/tqtc-qtremoteobjects | Status: MERGED | +2 | 0 |