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 Pick-to: 6.8 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>
This commit is contained in:
parent
b5ff268a3b
commit
e4502f3dc1
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user