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

QPainterPath undefined behavior with NaNs in coordinates (with patch)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Not Evaluated Not Evaluated
    • None
    • 4.7.1, 4.8.x
    • GUI: Painting
    • None
    • 004653e63b2c20f32750c54a609572329903d8be

      QPainterPath can't handle NaNs inside coordinates, but instead of safely ignoring or aborting an operation, it shows a warning and keeps going on, with undefined behavior. Sometimes leading to infinite loops, leaks or crashes (see qtwebkit example below).

      This is particularly bad when QPainterPath is used to render content from untrusted sources (web or user data). As an example, there's a qtwebkit bug where the browser crashes when a particular SVG is loaded: https://bugs.webkit.org/show_bug.cgi?id=51698.

      Please note that "untrusted sources" doesn't apply only to network sources. This behavior can probably be exploited on applications such as file-browsers with previews enabled.

      I'm about to submit a merge request where QPainterPath ignores the operation (moveTo(), lineTo(), cubicTo(), quadTo(), arcTo(), addRect(), addEllipse() and operator>>()) if a NaN is found in the coordinates (instead of staying in undefined state). It should be far safer than the current implementation.

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

            stormols Marius Storm-Olsen
            ademar Ademar de Souza Reis Jr.
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes