diff options
author | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2020-12-01 14:39:59 +0100 |
---|---|---|
committer | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2020-12-08 18:16:03 +0000 |
commit | fbe87464350f8bd66ddef5653280fac6bfadab3b (patch) | |
tree | f1239040d24f50c8ebd55e27b3173a7c6acb707d | |
parent | 80fe597932f9ed930d33035d5be585c307265545 (diff) | |
download | qtsvg-fbe87464350f8bd66ddef5653280fac6bfadab3b.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)
-rw-r--r-- | src/svg/qsvghandler.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp index 0190e69..73e8fb7 100644 --- a/src/svg/qsvghandler.cpp +++ b/src/svg/qsvghandler.cpp @@ -64,6 +64,7 @@ #include "private/qmath_p.h" #include "float.h" +#include <cmath> QT_BEGIN_NAMESPACE @@ -671,6 +672,8 @@ static qreal toDouble(const QChar *&str) val = -val; } else { val = QByteArray::fromRawData(temp, pos).toDouble(); + if (std::fpclassify(val) != FP_NORMAL) + val = 0; } return val; |