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.9 6.8 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This commit is contained in:
parent
45e90b73c7
commit
8e843ddba8
@ -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