QProgressBar: prevent integer overflow

If `value` is INT_MAX and `lastPaintedValue` is -1 (the default), the
subtraction will overflow. Extend the arguments to 64 bits. The result
is only used for a double comparison anyhow.

Change-Id: Id4a5396c61da81932ac626b3102e583a74264df4
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 8e843ddba8de6b9dbe9851856fd4524af5d3c584)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit e4502f3dc1526213c775ba01d3945fdb5b9ea8dc)
bb10
Giuseppe D'Angelo 2025-01-28 03:14:48 +01:00 committed by Qt Cherry-pick Bot
parent 05e0fb988d
commit ed9a347b89
1 changed files with 1 additions and 1 deletions

View File

@ -111,7 +111,7 @@ bool QProgressBarPrivate::repaintRequired() const
if (value == lastPaintedValue)
return false;
const int valueDifference = qAbs(value - lastPaintedValue);
const qint64 valueDifference = qAbs(qint64(value) - qint64(lastPaintedValue));
if (value == minimum || value == maximum)
return true;