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

Undefined behaviour in QProgressBar::reset

XMLWordPrintable

    • f4d3c87f0caab71f15e12f0f376f94a3e90a8adf

      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;
      

        For Gerrit Dashboard: QTBUG-57857
        # Subject Branch Project Status CR V

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes