From aceea78cc05ac8ff947cee9de8149b48771781a8 Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Tue, 1 Dec 2020 14:39:59 +0100 Subject: 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 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 428d56da9d5ed9bda51f7cc3c144996fb3a6a285) Reviewed-by: Qt Cherry-pick Bot --- src/svg/qsvghandler.cpp | 3 +++ 1 file changed, 3 insertions(+) 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 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; -- cgit v1.2.1