summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEirik Aavitsland <eirik.aavitsland@qt.io>2020-12-01 14:39:59 +0100
committerRobert Loehning <robert.loehning@qt.io>2020-12-03 08:27:06 +0000
commit428d56da9d5ed9bda51f7cc3c144996fb3a6a285 (patch)
tree7118caaf3b3ff8a92bef628a47cc863671a68300 /src
parent3f670687b9d3880329ac29f40e6f198762e54757 (diff)
downloadqtsvg-428d56da9d5ed9bda51f7cc3c144996fb3a6a285.tar.gz
Improve handling of malformed numeric values in svg files
Catch cases where the input is not containable in a qreal, and avoid passing on inf values. Pick-to: 6.0 5.15 5.12 Change-Id: I1ab8932d94473916815385240c29e03afb0e0c9e Reviewed-by: Robert Loehning <robert.loehning@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/svg/qsvghandler.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp
index 2fd24bb..ce58a7b 100644
--- a/src/svg/qsvghandler.cpp
+++ b/src/svg/qsvghandler.cpp
@@ -65,6 +65,7 @@
#include "private/qmath_p.h"
#include "float.h"
+#include <cmath>
QT_BEGIN_NAMESPACE
@@ -679,6 +680,8 @@ static qreal toDouble(const QChar *&str)
val = -val;
} else {
val = QByteArray::fromRawData(temp, pos).toDouble();
+ if (qFpClassify(val) != FP_NORMAL)
+ val = 0;
}
return val;