diff options
author | Robert Löhning <robert.loehning@qt.io> | 2021-02-26 22:37:32 +0100 |
---|---|---|
committer | Robert Löhning <robert.loehning@qt.io> | 2021-03-02 16:06:06 +0000 |
commit | 37fab0d69491356d820d8e8a589ecf2cd6c31384 (patch) | |
tree | a2aef2d930f31d7f8c2bb7740ee2a60f68432500 /src/gui | |
parent | d3983db3c5be17be1bd6d23d1070566929ec9857 (diff) |
Limit value in setFontSizeFromValue()
Avoids overflows in QFreetypeFace::computeSize and
QFontEngineBox::boundingBox
Fixes oss-fuzz issue 30290
Change-Id: If8e9ff74bf706a701e26832ad21b3439a3b437f7
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 976fede67ca4a4d322bc8d2c00266a2e2f1a6e3d)
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/text/qcssparser.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp index 967b30f8f0..2e12616cef 100644 --- a/src/gui/text/qcssparser.cpp +++ b/src/gui/text/qcssparser.cpp @@ -1140,14 +1140,14 @@ static bool setFontSizeFromValue(QCss::Value value, QFont *font, int *fontSizeAd s.chop(2); value.variant = s; if (value.variant.convert((QVariant::Type)qMetaTypeId<qreal>())) { - font->setPointSizeF(value.variant.toReal()); + font->setPointSizeF(qBound(qreal(0), value.variant.toReal(), qreal(1 << 24) - 1)); valid = true; } } else if (s.endsWith(QLatin1String("px"), Qt::CaseInsensitive)) { s.chop(2); value.variant = s; if (value.variant.convert(QMetaType::Int)) { - font->setPixelSize(value.variant.toInt()); + font->setPixelSize(qBound(0, value.variant.toInt(), (1 << 24) - 1)); valid = true; } } |