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

Undefined behaviour in QProgressBar::reset

    XMLWordPrintable

Details

    • f4d3c87f0caab71f15e12f0f376f94a3e90a8adf

    Description

      Possible signed integer overflow in QProgressBar::reset is undefined behaviour as per C++11:

          d->value = d->minimum - 1;
          if (d->minimum == INT_MIN)
              d->value = INT_MIN;
      

      If d->minimum is INT_MIN already, subtracting one from it results in UB. A minor transformation helps already:

          if (d->minimum == INT_MIN)
              d->value = INT_MIN;
          else
              d->value = d->minimum - 1;
      

      Attachments

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

        Activity

          People

            mmutz Marc Mutz
            kamajii Sven Pauli
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes