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

Division by zero in QStyleSheetStyle::drawControl

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.9.5
    • 5.9, 5.10
    • Widgets: Style Sheets
    • None
    • macOS 10.12
    • 0236e3ab94508b700a11ab83fab7bbd39ee651bf

    Description

      I have built qtbase with -fsanitize undefined, and after executing an example (webengine simplebrowser) I got this error:

      /Volumes/T3/Dev/qt/qt510_source/qtbase/src/widgets/styles/qstylesheetstyle.cpp:3978:41: runtime error: division by zero
      SUMMARY: AddressSanitizer: undefined-behavior /Volumes/T3/Dev/qt/qt510_source/qtbase/src/widgets/styles/qstylesheetstyle.cpp:3978:41 in
      /Volumes/T3/Dev/qt/qt510_source/qtbase/src/widgets/styles/qstylesheetstyle.cpp:3978:41: runtime error: value nan is outside the range of representable values of type 'int'
      SUMMARY: AddressSanitizer: undefined-behavior /Volumes/T3/Dev/qt/qt510_source/qtbase/src/widgets/styles/qstylesheetstyle.cpp:3978:41 in
      /Volumes/T3/Dev/qt/qt510_source/qtbase/src/widgets/styles/qstylesheetstyle.cpp:3978:41: runtime error: division by zero
      SUMMARY: AddressSanitizer: undefined-behavior /Volumes/T3/Dev/qt/qt510_source/qtbase/src/widgets/styles/qstylesheetstyle.cpp:3978:41 in
      

      Here is the relevant part of the code

      int x = reverse ? r.left() + r.width() - chunkWidth : r.x();
      
                          for (int i = 0; i < ceil(qreal(fillWidth)/chunkWidth); ++i) {
                              r.setRect(x, rect.y(), chunkWidth, rect.height());
                              r = m.mapRect(QRectF(r)).toRect();
                              subRule.drawRule(p, r);
                              x += reverse ? -chunkWidth : chunkWidth;
                          }
      

      which is in the switch case "CE_ProgressBarContents".
      I supposed chunkWidth is 0.

      Attachments

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

        Activity

          People

            dedietri Gabriel de Dietrich (drgvond)
            alexandru.croitor Alexandru Croitor
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes