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

CurveRenderer crashes when calculating dash pattern

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 6.7.1, 6.8.0 FF
    • 6.6.2, 6.6.3, 6.7.0 RC2
    • Quick: Shapes
    • None
    • 1314d046f (dev), efa233bc4 (6.7)

    Description

      Using the Shape.CurveRenderer as the preferred renderer can cause crashes for certain line geometries when using a dash pattern.

      The following QML example reproduces the crash (on Windows)

      import QtQuick
      import QtQuick.Shapes
      
      Window {
          id: root;
          width: 640
          height: 480
          visible: true
          title: qsTr("Hello World")   
         
          Shape
          {
              preferredRendererType: Shape.CurveRenderer;        
              ShapePath
              {
                  startX: -1.654507349898284;
                  startY: 2.5602595487477107
                  dashPattern: [2, 2];
                  dashOffset: 4;
                  strokeWidth: 5.8575662686300545;
                  strokeColor: "purple";
                  capStyle: ShapePath.FlatCap;
                  strokeStyle: ShapePath.DashLine;
                  joinStyle: ShapePath.RoundJoin;             
                  PathLine
                  {
                      x: 119.95107002130986;
                      y: 81.14499586882086
                  }
              }
          }
      } 

      This causes an assertion to be hit in the QQuadPath::dashed method:

      ...
      while (true) {
          bool gotAll = cutter.consume(pattern.at(dashIndex) - offset);
                                                  ^^^^^^^^^
          QVector2D nextPoint = cutter.currentCutPoint();
              if (dashIndex & 1)
      ...

      where dashIndex has the value 2, where pattern is a QVarLengthArray of length 2, causing an index out of bounds assertion: n <= size() - pos

       

      Attachments

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

        Activity

          People

            vgt Eirik Aavitsland
            nielsb Niels Billen
            Votes:
            4 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes