Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-116151

Replica can crash with QHostAddress being called with a <null reference>

    XMLWordPrintable

Details

    • 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

        1. RO_crash_stack_trace.png
          128 kB
          Tuomas Vaarala
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kleint Friedemann Kleint
            tuomas.vaarala Tuomas Vaarala
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews