summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Motoyoshi Kalland <kim.kalland@nokia.com>2010-04-20 13:24:13 (GMT)
committerSamuli Piippo <samuli.piippo@digia.com>2011-06-09 10:05:42 (GMT)
commit998bd0db4e676bb19e958bc31aa4fbce7aa3100f (patch)
tree08e462c034ea203a14e081fdb67ede23efc2755d
parentd8adfcca25d185e7233c09711843bddfd596c657 (diff)
downloadQt-998bd0db4e676bb19e958bc31aa4fbce7aa3100f.zip
Qt-998bd0db4e676bb19e958bc31aa4fbce7aa3100f.tar.gz
Qt-998bd0db4e676bb19e958bc31aa4fbce7aa3100f.tar.bz2
Fixed assert failure when trying to load invalid SVG file.
Task-number: QTBUG-10022 Reviewed-by: Trond (cherry picked from commit 13732b74e07fe10e95f2601f6cf2d0be78467eaa)
-rw-r--r--src/svg/qsvghandler.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp
index d36690e..155c391 100644
--- a/src/svg/qsvghandler.cpp
+++ b/src/svg/qsvghandler.cpp
@@ -3525,7 +3525,11 @@ void QSvgHandler::parse()
// namespaceUri is empty. The only possible strategy at
// this point is to do what everyone else seems to do and
// ignore the reported namespaceUri completely.
- startElement(xml->name().toString(), xml->attributes());
+ if (!startElement(xml->name().toString(), xml->attributes())) {
+ delete m_doc;
+ m_doc = 0;
+ return;
+ }
break;
case QXmlStreamReader::EndElement:
endElement(xml->name());
@@ -3570,6 +3574,9 @@ bool QSvgHandler::startElement(const QString &localName,
m_whitespaceMode.push(QSvgText::Default);
}
+ if (!m_doc && localName != QLatin1String("svg"))
+ return false;
+
if (FactoryMethod method = findGroupFactory(localName)) {
//group
node = method(m_doc ? m_nodes.top() : 0, attributes, this);