diff options
author | Robert Loehning <robert.loehning@qt.io> | 2020-10-09 11:57:10 +0200 |
---|---|---|
committer | Robert Loehning <robert.loehning@qt.io> | 2020-11-24 14:27:40 +0000 |
commit | 218b92c9e5fb1beae0e293443c8b637464d502f3 (patch) | |
tree | 147fa973ecfabe9452cc093d9ffd359c37826cfe /src/gui | |
parent | 98f03d9e33a041ace2d282bdd36b7412365d93ec (diff) |
Limit value in setFontWeightFromValue()
Fixes: oss-fuzz-24986
Change-Id: Ic65139a7821be3a12c65444d010736f03c8b74f5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit ccc205bf38ffbe60180a069939a4aff01e7734e5)
Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/text/qcssparser.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp index 663f727145..7f2c01d4d3 100644 --- a/src/gui/text/qcssparser.cpp +++ b/src/gui/text/qcssparser.cpp @@ -1192,7 +1192,7 @@ static bool setFontWeightFromValue(const QCss::Value &value, QFont *font) } if (value.type != Value::Number) return false; - font->setWeight(qMin(value.variant.toInt() / 8, 99)); + font->setWeight(qRound(qBound(0.0, value.variant.toDouble() / 8.0, 99.0))); return true; } |