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 16:46:11 +0000 |
commit | a4fa3cce0bf8b51a7073d6c699b86782249c6606 (patch) | |
tree | 37ac5f02407ee2577f6e970b386bfdfb9640d0d1 | |
parent | c4748f909c2de24b49e9867cfc50b03fc168db6a (diff) |
Limit value in setFontWeightFromValue()
QFont::setWeight() just accepts values between 0 and 900 anyway.
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>
-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 78ddc04afd..7fc90156e5 100644 --- a/src/gui/text/qcssparser.cpp +++ b/src/gui/text/qcssparser.cpp @@ -1153,7 +1153,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; } |