From e5a92ddbcaa23e782cecdfa4c1848856e1765a61 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 5 Mar 2021 12:52:36 +0100 Subject: Improve parsing of "r" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Negative r values are illegal, and zero means empty for circles. Change-Id: Icb1d932f35909f71dafe1ee69eb2250eeb1bb2ad Reviewed-by: MÃ¥rten Nordheim (cherry picked from commit 4a88e194e6b243e83703ad83d95e49b2febed99e) Reviewed-by: Qt Cherry-pick Bot --- src/svg/qsvghandler.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp index 3d9297f..e554b47 100644 --- a/src/svg/qsvghandler.cpp +++ b/src/svg/qsvghandler.cpp @@ -2560,6 +2560,8 @@ static QSvgNode *createCircleNode(QSvgNode *parent, qreal ncx = toDouble(cx); qreal ncy = toDouble(cy); qreal nr = toDouble(r); + if (nr < 0.0) + return nullptr; QRectF rect(ncx-nr, ncy-nr, nr*2, nr*2); QSvgNode *circle = new QSvgCircle(parent, rect); @@ -3030,15 +3032,16 @@ static QSvgStyleProperty *createRadialGradientNode(QSvgNode *node, qreal ncx = 0.5; qreal ncy = 0.5; - qreal nr = 0.5; if (!cx.isEmpty()) ncx = toDouble(cx); if (!cy.isEmpty()) ncy = toDouble(cy); + + qreal nr = 0.0; if (!r.isEmpty()) nr = toDouble(r); - if (nr < 0.5) - nr = 0.5; + if (nr <= 0.0) + return nullptr; qreal nfx = ncx; if (!fx.isEmpty()) -- cgit v1.2.1