summaryrefslogtreecommitdiffstats
path: root/src/xml
diff options
context:
space:
mode:
authorFrank Osterfeld <frank@kdab.net>2009-08-26 10:53:35 +0200
committerPeter Hartmann <peter.hartmann@trolltech.com>2009-08-26 11:15:30 +0200
commitd95d33e67129eaa843fc0582abfe2f25ce87847d (patch)
tree3b554dd59e2d60949b55c7d4a7a8c533160fabfd /src/xml
parent01255c3b33de2f72ff0b8802e8bea0ea79998f00 (diff)
QXmlSimpleReader: fix crash
Don't crash when parsing "<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?><guid><http://www.foo.dk/artikel/8938</guid>" (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 <peter.hartmann@trolltech.com>
Diffstat (limited to 'src/xml')
-rw-r--r--src/xml/dom/qdom.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp
index 7709c28caf..ac6ba37a29 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();