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

Streaming of invalid QVariant incompatible/broken

    XMLWordPrintable

Details

    • I0408293e43c3330dbc4746198a19709e795f552a

    Description

      Commit 7934c75f844dd9a42315b18870cc72dd3e17191a (gerrit https://codereview.qt-project.org/#change,14462) in qtbase changed the mapping of old Qt 3 types to return 0 for QColorGroups but this breaks QVariant::save(QDataStream &s) when saving an invalid QVariant. The save() method will now lookup a typeId of 12 instead of 0 because the loop iterating over that map starts at the end.

      When reading this data with a QDataStream in Qt < 5 it will result in a QVariant holding a QColorGroup instead of being an invalid variant, this breaks communication between Qt 3/4 and Qt 5 applications when they also rely on invalid QVariants as part of their protocol.

      Attached is a minimal example that verifies the first few bytes. Byte 4 should be 0 instead of 12. When compiling this with Qt 4 everything is fine, with Qt 5 the last assertion does not hold true.

      Attachments

        Issue Links

          Activity

            People

              nierob Nierob
              metz Stefan Gehn (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: