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

SIGSEGV in QHostAddress(QHostAdddress const&)

    XMLWordPrintable

    Details

      Description

      This happens also with Qt 5.3.1 with a websocket backend service on high-load.

      Program received signal SIGSEGV, Segmentation fault.
      0x00007ffff7907dde in QHostAddress::QHostAddress(QHostAddress const&) ()
      from /home/juhapekka/Qt5.3.0/5.3/gcc_64/lib/libQt5Network.so.5
      (gdb) bt
      #0 0x00007ffff7907dde in QHostAddress::QHostAddress(QHostAddress const&) ()
      from /home/juhapekka/Qt5.3.0/5.3/gcc_64/lib/libQt5Network.so.5
      #1 0x00007ffff792aad4 in QAbstractSocket::peerAddress() const ()
      from /home/juhapekka/Qt5.3.0/5.3/gcc_64/lib/libQt5Network.so.5
      #2 0x00007ffff7bbe75a in ?? ()
      from /home/juhapekka/Qt5.3.0/5.3/gcc_64/lib/libQt5WebSockets.so.5
      #3 0x00007ffff7bbc14d in QWebSocket::peerAddress() const ()
      from /home/juhapekka/Qt5.3.0/5.3/gcc_64/lib/libQt5WebSockets.so.5

      I found that the most obvious reason for it is
      #define QT_ENSURE_PARSED(a) \
      do

      { \ if (!(a)->d->isParsed) \ (a)->d->parse(); \ }

      while (0)

      https://qt.gitorious.org/qt/qt/source/57756e72adf2081137b97f0e689dd16c770d10b1
      :src/network/kernel/qhostaddress.cpp#L61

      Which is lacking a null pointer check.

      For example it is used here:

      For example it is used in here where if the this or other are NULL it will
      cause a crash.
      https://qt.gitorious.org/qt/qt/source/57756e72adf2081137b97f0e689dd16c770d10b1
      :src/network/kernel/qhostaddress.cpp#L818

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            richmoore Richard Moore (qtnetwork)
            Reporter:
            juhapekka.piiroinen Juhapekka Piiroinen
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes