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

Segmentation fault while trying to get a QVariant from a QJsonValue containing an empty QJsonObject or QJsonArray

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.2.0
    • 5.1.0
    • Core: Other
    • None
    • OS: Ubuntu 13.04 32 bits
      Qt version: Qt 5.1 given by the Qt Project online installer (i.e. not the Qt5 version in Ubuntu repositories)
    • 77833b90c8d93b86904b744f7be2926ba377ca6e

    Description

      While coding a personal program, I saw some unexpected segmentation faults when I use the "QVariant QJsonValue::toVariant();" method on a QJsonValue containing an empty QJsonArray:

      QJsonArray a; // a = []
      QJsonValue v(a); // QJsonValue with the empty QJsonArray
      QVariant vari = v.toVariant(); // Segmentation fault (SIGSEGV)

      While trying to reproduce the bug in my personal program, I also noticed that the same SIGSEGV happened with an empty QJsonObject:

      QJsonObject o; // o = {}
      QJsonValue v(o); // QJsonValue with the empty QJsonObject
      QVariant vari = v.toVariant(); // Segmentation fault (SIGSEGV)

      I do not thing that I missed something dealing with that in the Qt Documentation. Moreover, I do not remember getting such a bug with Qt 5.0.

      Attachments

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

        Activity

          People

            kleint Friedemann Kleint
            air-dex Romain Ducher
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes