From 13732b74e07fe10e95f2601f6cf2d0be78467eaa Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Tue, 20 Apr 2010 15:24:13 +0200 Subject: Fixed assert failure when trying to load invalid SVG file. Task-number: QTBUG-10022 Reviewed-by: Trond --- src/svg/qsvghandler.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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); -- cgit v0.12