File 0020-Improve-handling-of-malformed-numeric-values-in-svg-.patch of Package libqt5-qtsvg.29651

From e53bfbf87dbef0bb15ac42b129bcdf2e4ffbefba Mon Sep 17 00:00:00 2001
From: Eirik Aavitsland <eirik.aavitsland@qt.io>
Date: Tue, 1 Dec 2020 14:39:59 +0100
Subject: [PATCH 20/21] 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)
(cherry picked from commit fbe87464350f8bd66ddef5653280fac6bfadab3b)
---
 src/svg/qsvghandler.cpp | 3 +++
 1 file changed, 3 insertions(+)

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;
 
-- 
2.20.1

openSUSE Build Service is sponsored by