summaryrefslogtreecommitdiffstats
path: root/src/xml
diff options
context:
space:
mode:
authorFrank Osterfeld <frank@kdab.net>2009-08-26 08:53:35 (GMT)
committerPeter Hartmann <peter.hartmann@trolltech.com>2009-08-26 09:15:30 (GMT)
commitd95d33e67129eaa843fc0582abfe2f25ce87847d (patch)
tree3b554dd59e2d60949b55c7d4a7a8c533160fabfd /src/xml
parent01255c3b33de2f72ff0b8802e8bea0ea79998f00 (diff)
downloadQt-d95d33e67129eaa843fc0582abfe2f25ce87847d.zip
Qt-d95d33e67129eaa843fc0582abfe2f25ce87847d.tar.gz
Qt-d95d33e67129eaa843fc0582abfe2f25ce87847d.tar.bz2
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 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();