summaryrefslogtreecommitdiffstats
path: root/src/xml
diff options
context:
space:
mode:
authorFrank Osterfeld <frank@kdab.net>2010-08-05 13:42:58 +0200
committerOlivier Goffart <olivier.goffart@nokia.com>2010-08-05 13:44:17 +0200
commit637d207e397c13c09a8dcbd718ee85bce2548e90 (patch)
treeb2f1622b6099ff6711e159e3393c2357563cfa6d /src/xml
parente5071275f719ec36ff5e14b1e92258f270ef22b6 (diff)
QDom: Do not crash on "<a:>text</a:>"
"a:" is not a valid tagname. The function creating the element node notices that and returns 0, but the parser ignores it and continues, and then crashes later when processing the "text". This patch aborts the parsing immediately when creating the element node failed and fixes the crash. Merge-request: 2431 Reviewed-by: Olivier Goffart <olivier.goffart@nokia.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 1267e7e280..662c796379 100644
--- a/src/xml/dom/qdom.cpp
+++ b/src/xml/dom/qdom.cpp
@@ -7418,8 +7418,10 @@ bool QDomHandler::startElement(const QString& nsURI, const QString&, const QStri
n = doc->createElement(qName);
}
- if (n)
- n->setLocation(locator->lineNumber(), locator->columnNumber());
+ if (!n)
+ return false;
+
+ n->setLocation(locator->lineNumber(), locator->columnNumber());
node->appendChild(n);
node = n;