From 989007d6207c4bf2d97e2bc04ccc4f6456f82b94 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Tue, 13 Jul 2021 13:49:54 +0300 Subject: [PATCH] use QSTACKARRAY() macro in toDouble() function Signed-off-by: Ivailo Monev --- src/svg/qsvghandler.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp index 0f5bbd74d..acbe6b83e 100644 --- a/src/svg/qsvghandler.cpp +++ b/src/svg/qsvghandler.cpp @@ -44,6 +44,7 @@ #include "qnumeric.h" #include "qvarlengtharray.h" #include "qmath.h" +#include "qcorecommon_p.h" #include @@ -462,8 +463,8 @@ static inline bool isDigit(ushort ch) static qreal toDouble(const QChar *&str) { - const int maxLen = 255;//technically doubles can go til 308+ but whatever - char temp[maxLen+1]; + static const int maxLen = 255; // technically doubles can go til 308+ but whatever + QSTACKARRAY(char, temp, maxLen + 1); int pos = 0; if (*str == QLatin1Char('-')) { @@ -499,8 +500,6 @@ static qreal toDouble(const QChar *&str) } } - temp[pos] = '\0'; - qreal val; if (!exponent && pos < 10) { int ival = 0; -- 2.11.0