From d95d33e67129eaa843fc0582abfe2f25ce87847d Mon Sep 17 00:00:00 2001 From: Frank Osterfeld Date: Wed, 26 Aug 2009 10:53:35 +0200 Subject: QXmlSimpleReader: fix crash Don't crash when parsing "" (unmatched "< tag followed by "foo:") using QDomDocument::setContent together with a QXmlSimpleReader with the "http://xml.org/sax/features/namespaces" feature enabled. Fixes task tracker issue 254700. See there for a test case. Merge-request: 1322 Reviewed-by: Peter Hartmann --- src/xml/dom/qdom.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp index 7709c28..ac6ba37 100644 --- a/src/xml/dom/qdom.cpp +++ b/src/xml/dom/qdom.cpp @@ -7406,7 +7406,9 @@ bool QDomHandler::startElement(const QString& nsURI, const QString&, const QStri } else { n = doc->createElement(qName); } - n->setLocation(locator->lineNumber(), locator->columnNumber()); + + if (n) + n->setLocation(locator->lineNumber(), locator->columnNumber()); node->appendChild(n); node = n; @@ -7426,7 +7428,7 @@ bool QDomHandler::startElement(const QString& nsURI, const QString&, const QStri bool QDomHandler::endElement(const QString&, const QString&, const QString&) { - if (node == doc) + if (!node || node == doc) return false; node = node->parent(); -- cgit v0.12