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

Division by zero problem in QTriangulatingStroker::moveTo in src/opengl/gl2paintengineex/qtriangulatingstroker.cpp

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.0.0
    • 4.6.3, 4.7.0, 4.7.1
    • GUI: OpenGL
    • None
    • d13e3441a9a3f11c7f9c9ebb21a514526987f56e

    Description

      I came across a problem in QTriangulatingStroker while debugging a program I'm working on.
      I'm using QGraphicsView with OpenGL and quite large coordinates (ok, my fault...).

      Large, and very close coordinates (e.g. y1 = -6022459.06174 and y2 = -6022459.17404, x1=x2) are casted from qreal(double) to float in QTriangulatingStroker::moveTo() and then passed to QTriangulatingStroker::normalVector(). After being converted to float both values equal -6022459.0 and normalVector tries to divide by the difference of them thus divides by zero.

      The resulting invalid normal vector (-1.#IND000) is then passed to QTriangulatingStroker::arcPoints() in "case Qt::RoundCap" leading to "QVarLengthArray<float> points" of size 0.

      The following while loop is never entered and in if( invisibleJump ) "..." m_vertices.at( count + 1 ) leads to an Q_ASSERT error because count is still m_vertices.size().

      Summary: floating point precision problem --> uncaught devision by zero --> array bounds exception.

      Attachments

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

        Activity

          People

            kkalland Kim Motoyoshi Kalland (Inactive)
            rpersicke Rainer Persicke
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes