Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-18624

Division by 0 in ServerModeReader::handleProgress

    XMLWordPrintable

    Details

      Description

      In the function ServerModeReader::handleProgress, on line 420:

      int progress = m_progressStepMinimum
      
      + (((max - min) / (cur - min)) * (m_progressStepMaximum - m_progressStepMinimum));

       

      we can have a division by zero when cur == min, this has happend to me when loading a very big cmake project. In addition the formula looks wrong to calculate the progress, looks to me it should be (perhaps using float instead):

      int progress = m_progressStepMinimum + ((cur - min) / (max - min)) * (m_progressStepMaximum - m_progressStepMinimum));

        Attachments

        For Gerrit Dashboard: QTCREATORBUG-18624
        # Subject Branch Project Status CR V

          Activity

            People

            Assignee:
            hunger Tobias Hunger
            Reporter:
            mmaldacker Max Maldacker
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes