summaryrefslogtreecommitdiffstats
path: root/tests/auto/xml
diff options
context:
space:
mode:
authorJoni Poikelin <joni.poikelin@theqtcompany.com>2015-10-29 09:43:33 +0200
committerJoni Poikelin <joni.poikelin@theqtcompany.com>2015-10-29 08:05:45 +0000
commitb20d6cded7be8b86bed93ee705420bfb01700c5b (patch)
tree4de4947ca8489dade5d3e2fc63ba9302c260a582 /tests/auto/xml
parent26238aca8c442736f380eb523ef48468f892bdb7 (diff)
Fix QDomNamedNodeMap::item crash with negative index
Task-number: QTBUG-49113 Change-Id: I62dee4c112b73a25628657bc3d2ae675f26b87d8 Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'tests/auto/xml')
-rw-r--r--tests/auto/xml/dom/qdom/tst_qdom.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/auto/xml/dom/qdom/tst_qdom.cpp b/tests/auto/xml/dom/qdom/tst_qdom.cpp
index a4a3f1f6b3..04cd0b300f 100644
--- a/tests/auto/xml/dom/qdom/tst_qdom.cpp
+++ b/tests/auto/xml/dom/qdom/tst_qdom.cpp
@@ -119,6 +119,7 @@ private slots:
void cloneDTD_QTBUG8398() const;
void DTDNotationDecl();
void DTDEntityDecl();
+ void QTBUG49113_dontCrashWithNegativeIndex() const;
void cleanupTestCase() const;
@@ -1979,5 +1980,13 @@ void tst_QDom::DTDEntityDecl()
QCOMPARE(doctype.namedItem(QString("logo")).toEntity().notationName(), QString("gif"));
}
+void tst_QDom::QTBUG49113_dontCrashWithNegativeIndex() const
+{
+ QDomDocument doc;
+ QDomElement elem = doc.appendChild(doc.createElement("root")).toElement();
+ QDomNode node = elem.attributes().item(-1);
+ QVERIFY(node.isNull());
+}
+
QTEST_MAIN(tst_QDom)
#include "tst_qdom.moc"