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

QJsonDocument segfault in equality operator

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P1: Critical
    • Resolution: Done
    • Affects Version/s: 5.15.0
    • Fix Version/s: 5.15.1
    • Component/s: Core: Other
    • Labels:
      None
    • Commits:
      e790af0e0a030dea597bbc9489170b5ba1cf9e46 (qt/qtbase/dev) 801f719f12da68508a21ecebf1b37db6650beb8a (qt/qtbase/5.15)

      Description

      QJsonDocument::operator== does not check if 'other' is valid before accessing

      'other.d->value'.

       

      bool QJsonDocument::operator==(const QJsonDocument &other) const
      {
          return (!d) ? (!other.d) : (d->value == other.d->value);
      }

       

      Something like the following leads to a segfault.

      QJsonDocument validDoc = ... // a valid json document
      QJsonDocument invalidDoc{}; // an invalid json document
      if (validDoc == invalidDoc) { // segfault here
          ...
      }

       

        Attachments

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

          Activity

            People

            Assignee:
            thiago Thiago Macieira
            Reporter:
            ah ah
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes