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()); }