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

[Qt SVG] QML Image bad source crashes application instead of error status (QSvgHandler::parse)

    XMLWordPrintable

Details

    • edc8ca7f1 (dev), effc44495 (6.6), e52b6e1b8 (6.5), 0d646f6d2 (tqtc/lts-6.2), a090bd1f9 (dev), 7eb8f6391 (dev), 0bfb42057 (6.6), f12f89393 (6.6), 97db6d901 (6.5), 0c1345543 (6.5), d8ce66da0 (dev)

    Description

      Hello!

      Unfortunately the QML Image can crash the whole application without being able to react, if a source is specified that has bad image data (which by specifying a URL is often not known ahead). The crash happens due it's assumed to be a SVG (while it's not) and the SVG parsing is seemingly not good enough guarded to handle errors, instead crashes.

      The crash happened here on Qt 6.6.0 gcc_64 I installed fresh today. OS is Ubuntu 22.04.
      Note: I can NOT reproduce the error in Qt 6.5.3 so seemingly this is a regression in Qt SVG module between Qt 6.5.3 - 6.6.0.

      Minimal example

      import QtQuick
      import QtQuick.Window
      import QtQuick.Controls
      Window {
          width: 900
          height: 600
          visible: true
      
          Image {
              anchors.centerIn: parent
              source: "https://slashdot.org/slashdot-it.pl?op=discuss&id=23088195&smallembed=1"
          }
      }

      A copy of the "image" is attached to the issue (retrieved with wget <URL>).
      Additional Qt SVG module is linked via CMakeLists.txt. Qt additional Image Formats are also installed.

      Expectation

      Yes, it's not a valid SVG image, or any image at all. Still, it should not produce a crash, but set a error state / mark as bad image via QImage::isNull=true.

      In this case it is some URL that was returned by a RSS feed as a image attachment. User inputs for QML source can be <anything>.

      Stacktrace

       

      Attachments

        Issue Links

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

          Activity

            People

              tvete Paul Olav Tvete
              de-live-gdev Gregor Santner
              Votes:
              5 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: