OSDN Git Service

fix crash on malformed SVG
authorIvailo Monev <xakepa10@gmail.com>
Wed, 13 Jan 2016 14:33:29 +0000 (16:33 +0200)
committerIvailo Monev <xakepa10@gmail.com>
Wed, 13 Jan 2016 14:33:29 +0000 (16:33 +0200)
upstream commits:
https://github.com/qtproject/qtsvg/commit/3167c1374bb918033b5b4a5b54e0d0608698eeb0

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
src/svg/qsvgstyle.cpp

index 107459e..0747c1a 100644 (file)
@@ -938,10 +938,9 @@ void QSvgGradientStyle::resolveStops()
 {
     if (!m_link.isEmpty() && m_doc) {
         QSvgStyleProperty *prop = m_doc->styleProperty(m_link);
-        if (prop) {
+        if (prop && prop != this) {
             if (prop->type() == QSvgStyleProperty::GRADIENT) {
-                QSvgGradientStyle *st =
-                    static_cast<QSvgGradientStyle*>(prop);
+                QSvgGradientStyle *st = static_cast<QSvgGradientStyle*>(prop);
                 st->resolveStops();
                 m_gradient->setStops(st->qgradient()->stops());
                 m_gradientStopsSet = st->gradientStopsSet();