Limit value in setFontWeightFromValue()
QFont::setWeight() just accepts values between 0 and 900 anyway. Fixes: oss-fuzz-24986 Pick-to: 5.12 5.15 Change-Id: Ic65139a7821be3a12c65444d010736f03c8b74f5 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
parent
ec1d553bbf
commit
ccc205bf38
@ -1195,7 +1195,8 @@ static bool setFontWeightFromValue(const QCss::Value &value, QFont *font)
|
||||
}
|
||||
if (value.type != Value::Number)
|
||||
return false;
|
||||
font->setWeight(QFont::Weight(value.variant.toInt()));
|
||||
// .toInt() would call qRound64() and might overflow the long long there
|
||||
font->setWeight(QFont::Weight(qRound(qBound(0.0, value.variant.toDouble(), 1001.0))));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user