summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Löhning <robert.loehning@qt.io>2021-07-23 13:53:47 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-07-27 14:45:24 +0000
commitf9ac5f3339564a26ec34aa1760dab55ccd017e52 (patch)
treef1bcf29fef56f47572306512b4d85d6a58aa76e3
parent758b40580aab89fc071d0bce9521c8d1e2990bdd (diff)
downloadqtsvg-f9ac5f3339564a26ec34aa1760dab55ccd017e52.tar.gz
Limit font size to avoid numerous overflows
The font size will be passed through a QFixed in QFontEngineBox::ascent() and overflow there as well as in further places. [ChangeLog] Avoid numerous overflows by limiting font size to 0xffff. This fixes oss-fuzz issue 31701. Change-Id: I2d00c5639804af9b056f0efc979e9899c5358cf7 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> (cherry picked from commit 76eeb072cdffc1a8c776ed01864e6751ccbfba85) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/svg/qsvghandler.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp
index 2ad13b4..f2757bd 100644
--- a/src/svg/qsvghandler.cpp
+++ b/src/svg/qsvghandler.cpp
@@ -1364,7 +1364,8 @@ static void parseFont(QSvgNode *node,
break;
case FontSizeValue: {
QSvgHandler::LengthType dummy; // should always be pixel size
- fontStyle->setSize(parseLength(attributes.fontSize, dummy, handler));
+ fontStyle->setSize(qMin(parseLength(attributes.fontSize, dummy, handler),
+ qreal(0xffff)));
}
break;
default: