summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2021-03-04 14:28:48 +0100
committerRobert Löhning <robert.loehning@qt.io>2021-03-04 22:51:25 +0100
commitbfd6ee0d8cf34b63d32adf10ed93daa0086b359f (patch)
tree07ff1252617af7ee5df858d5bcfede4a60c44bba /src
parentf45a08a0c8d3968b668e2b2e61cb736791a4acc5 (diff)
downloadqtsvg-bfd6ee0d8cf34b63d32adf10ed93daa0086b359f.tar.gz
Clamp parsed doubles to float representable values
Parts of our rendering assumes incoming doubles can still be sane floats. Pick-to: 6.1 6.0 5.15 5.12 Fixes: QTBUG-91507 Change-Id: I7086a121e1b5ed47695a1251ea90e774dd8f148d Reviewed-by: Robert Löhning <robert.loehning@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/svg/qsvghandler.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp
index ce58a7b..3d9297f 100644
--- a/src/svg/qsvghandler.cpp
+++ b/src/svg/qsvghandler.cpp
@@ -680,7 +680,8 @@ static qreal toDouble(const QChar *&str)
val = -val;
} else {
val = QByteArray::fromRawData(temp, pos).toDouble();
- if (qFpClassify(val) != FP_NORMAL)
+ // Do not tolerate values too wild to be represented normally by floats
+ if (qFpClassify(float(val)) != FP_NORMAL)
val = 0;
}
return val;
@@ -3036,6 +3037,8 @@ static QSvgStyleProperty *createRadialGradientNode(QSvgNode *node,
ncy = toDouble(cy);
if (!r.isEmpty())
nr = toDouble(r);
+ if (nr < 0.5)
+ nr = 0.5;
qreal nfx = ncx;
if (!fx.isEmpty())