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

Rendering malformed SVG file fails assert

    XMLWordPrintable

Details

    • 1e0395f73e624bf9d40f508acd3da08294006947 (qt/qtbase/5.12)

    Description

      1. Have a simple program:
        #include <QCoreApplication>
        #include <QImage>
        #include <QPainter>
        #include <QString>
        #include <QtSvg>
        
        int main(int argc, char *argv[])
        {
            QCoreApplication a(argc, argv);
        
            QImage image(200, 200, QImage::Format_RGB32);
            image.fill(0);
            QPainter painter(&image);
            QSvgRenderer renderer((QLatin1String(argv[1])));
            renderer.render(&painter);
            image.save(QLatin1String(argv[2]));
            return 0;
        }
        
      2. Pass the attached malformed SVG file to this program.
        It will quit with failed assert:
        1  __GI_raise                 raise.c                 54   0x7f23ff69b418 
        2  __GI_abort                 abort.c                 89   0x7f23ff69d01a 
        3  qt_message_fatal           qlogging.cpp            1648 0x7f24000741ff 
        4  QMessageLogger::fatal      qlogging.cpp            790  0x7f2400070252 
        5  qt_assert                  qglobal.cpp             2999 0x7f24000689d7 
        6  QRasterizer::rasterizeLine qrasterizer.cpp         755  0x7f2400a065b7 
        7  QRasterPaintEngine::stroke qpaintengine_raster.cpp 1613 0x7f240099a448 
        8  QPaintEngineEx::draw       qpaintengineex.cpp      599  0x7f240098b4da 
        9  QPaintEngineEx::drawPath   qpaintengineex.cpp      839  0x7f240098cf49 
        10 QPainter::drawPath         qpainter.cpp            3386 0x7f24009b90ac 
        11 QSvgPath::draw             qsvggraphics.cpp        163  0x7f2401eaabad 
        12 QSvgG::draw                qsvgstructure.cpp       65   0x7f2401ed9d4c 
        13 QSvgTinyDocument::draw     qsvgtinydocument.cpp    244  0x7f2401ee1ad8 
        14 QSvgTinyDocument::draw     qsvgtinydocument.cpp    380  0x7f2401ee23be 
        15 QSvgRenderer::render       qsvgrenderer.cpp        372  0x7f2401ee522e 
        16 main                       main.cpp                15   0x401325       
        

      It might not be possible to render this file correctly, but it should not trigger an assertion failure. The wrong value should probably be caught earlier on.

      Attachments

        1. backtrace.txt
          21 kB
        2. crash.svg
          7 kB
        3. small.svg
          0.2 kB

        Activity

          People

            vgt Eirik Aavitsland
            rlohning Robert Löhning
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: