summaryrefslogtreecommitdiffstats
path: root/src/svg
diff options
context:
space:
mode:
authorKim Motoyoshi Kalland <kim.kalland@nokia.com>2010-04-20 13:24:13 (GMT)
committerKim Motoyoshi Kalland <kim.kalland@nokia.com>2010-04-20 13:30:23 (GMT)
commit13732b74e07fe10e95f2601f6cf2d0be78467eaa (patch)
tree5ccd2b1a269c54fd4ca3a8efb0dbbfa2fd9ddfb0 /src/svg
parenta057a48cbac8acbf54a121c63a795480d3f9a8c0 (diff)
downloadQt-13732b74e07fe10e95f2601f6cf2d0be78467eaa.zip
Qt-13732b74e07fe10e95f2601f6cf2d0be78467eaa.tar.gz
Qt-13732b74e07fe10e95f2601f6cf2d0be78467eaa.tar.bz2
Fixed assert failure when trying to load invalid SVG file.
Task-number: QTBUG-10022 Reviewed-by: Trond
Diffstat (limited to 'src/svg')
-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 038aeb4..b6e771f 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);