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

Invalid assumption (and assertion) in QLineF::setLength

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Incomplete
    • P2: Important
    • None
    • 5.12.10, 5.15
    • GUI: Painting
    • None

    Description

      https://codereview.qt-project.org/q/I7b71d66b872ccc08a64e941acd36b45b0ea15fab added a Q_ASSERT in QLineF::setLength that can be hit using this simple test:

       

      int main(int argc, char *argv[])
      {
      	QApplication a(argc, argv);
      	QLineF line(QPointF(qQNaN(), qQNaN()), QPointF(qQNaN(), qQNaN()));
      	line.setLength(9.45);
      
      	return a.exec();
      }
      

      In this situation isValid() returns true for the line, but length() is NaN, which is not >0, so the Q_ASSERT is hit.

       

      Our application, which has its own programming language, allows users to draw lines, rectangles, etc. programmatically. We have a suite of fuzz tests to test this functionality, and one of the tests is now hitting this Q_ASSERT.

      We are also noticing a hang in the same fuzz tests when drawing rectangles that did not happen when we were using version 5.12.9. I haven't figured out a MCE to reproduce that hang yet, but it is almost certainly caused by the same Qt change as this bug.

      Clearly there is no realistic use case for drawing a line between to (Nan, Nan) points, but if the code that calls QLineF and such is now responsible for checking the validity of the values, that's a significant enough change that I would at least expect a change log entry.

      Attachments

        1. backtrace.txt
          6 kB
        2. main.cpp
          1 kB

        Issue Links

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

          Activity

            People

              vgt Eirik Aavitsland
              aclight Adam Light
              Votes:
              4 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes