summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-03-05 03:00:17 +0100
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-03-05 03:00:17 +0100
commit9106ab07092bb847a92c5ef9d4b8183db2a4da3f (patch)
tree366cbb67943f17368d81a4671ec3ee6f4790da66
parent43a0fc8412b9da42d81a508fc5265510f2dfd175 (diff)
parent65011e9f1b23ab62fff8d9327eeafedd29c91332 (diff)
downloadqtsvg-9106ab07092bb847a92c5ef9d4b8183db2a4da3f.tar.gz
Merge remote-tracking branch 'origin/5.13' into dev
Change-Id: I394d950125673f85e963e87bbaf6d2e6305a3ebb
-rw-r--r--src/svg/qsvghandler.cpp14
-rw-r--r--src/svg/qsvgtinydocument.cpp7
2 files changed, 16 insertions, 5 deletions
diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp
index dd31965..463ec01 100644
--- a/src/svg/qsvghandler.cpp
+++ b/src/svg/qsvghandler.cpp
@@ -1596,7 +1596,7 @@ static bool parsePathDataFast(const QStringRef &dataStr, QPainterPath &path)
const QChar *end = str + dataStr.size();
while (str != end) {
- while (str->isSpace())
+ while (str->isSpace() && (str + 1) != end)
++str;
QChar pathElem = *str;
++str;
@@ -3709,14 +3709,20 @@ bool QSvgHandler::startElement(const QString &localName,
}
break;
default:
+ const QByteArray msg = QByteArrayLiteral("Could not add child element to parent element because the types are incorrect.");
+ qCWarning(lcSvgHandler, "%s", prefixMessage(msg, xml).constData());
+ delete node;
+ node = 0;
break;
}
}
- parseCoreNode(node, attributes);
+ if (node) {
+ parseCoreNode(node, attributes);
#ifndef QT_NO_CSSPARSER
- cssStyleLookup(node, this, m_selector);
+ cssStyleLookup(node, this, m_selector);
#endif
- parseStyle(node, attributes, this);
+ parseStyle(node, attributes, this);
+ }
} else if (FactoryMethod method = findGraphicsFactory(localName)) {
//rendering element
Q_ASSERT(!m_nodes.isEmpty());
diff --git a/src/svg/qsvgtinydocument.cpp b/src/svg/qsvgtinydocument.cpp
index 15351bd..813395f 100644
--- a/src/svg/qsvgtinydocument.cpp
+++ b/src/svg/qsvgtinydocument.cpp
@@ -187,6 +187,7 @@ QSvgTinyDocument * QSvgTinyDocument::load(const QString &fileName)
} else {
qCWarning(lcSvgHandler, "Cannot read file '%s', because: %s (line %d)",
qPrintable(fileName), qPrintable(handler.errorString()), handler.lineNumber());
+ delete handler.document();
}
return doc;
}
@@ -207,6 +208,8 @@ QSvgTinyDocument * QSvgTinyDocument::load(const QByteArray &contents)
if (handler.ok()) {
doc = handler.document();
doc->m_animationDuration = handler.animationDuration();
+ } else {
+ delete handler.document();
}
return doc;
}
@@ -219,6 +222,8 @@ QSvgTinyDocument * QSvgTinyDocument::load(QXmlStreamReader *contents)
if (handler.ok()) {
doc = handler.document();
doc->m_animationDuration = handler.animationDuration();
+ } else {
+ delete handler.document();
}
return doc;
}
@@ -455,7 +460,7 @@ QMatrix QSvgTinyDocument::matrixForElement(const QString &id) const
t *= node->m_style.transform->qtransform();
node = node->parent();
}
-
+
return t.toAffine();
}