summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEirik Aavitsland <eirik.aavitsland@qt.io>2020-12-01 14:39:59 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2020-12-03 08:47:27 +0000
commitaceea78cc05ac8ff947cee9de8149b48771781a8 (patch)
treee67bb00520762596837cdca694cf90028d562c7c
parent9aac88424a1b76e0198b52437af58a6d94aff8e9 (diff)
downloadqtsvg-aceea78cc05ac8ff947cee9de8149b48771781a8.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. Change-Id: I1ab8932d94473916815385240c29e03afb0e0c9e Reviewed-by: Robert Loehning <robert.loehning@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit 428d56da9d5ed9bda51f7cc3c144996fb3a6a285) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-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 c937254..b3d9aaf 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
@@ -672,6 +673,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;