Skip to content

Commit 8852043

Browse files
committed
C++: Additional test cases.
1 parent add6579 commit 8852043

File tree

1 file changed

+25
-0
lines changed
  • cpp/ql/test/query-tests/Security/CWE/CWE-611

1 file changed

+25
-0
lines changed

cpp/ql/test/query-tests/Security/CWE/CWE-611/tests5.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,28 @@ void test5_6() {
7676
g_p1->parse(*g_data); // GOOD
7777
g_p2->parse(*g_data); // BAD (parser not correctly configured) [NOT DETECTED]
7878
}
79+
80+
void test5_7(DOMImplementationLS *impl, InputSource &data) {
81+
DOMLSParser *p = impl->createLSParser();
82+
83+
p->parse(data); // BAD (parser not correctly configured) [NOT DETECTED]
84+
85+
p->getDomConfig()->setParameter(XMLUni::fgXercesDisableDefaultEntityResolution, true);
86+
p->parse(data); // GOOD
87+
88+
p->getDomConfig()->setParameter(XMLUni::fgXercesDisableDefaultEntityResolution, false);
89+
p->parse(data); // BAD (parser not correctly configured) [NOT DETECTED]
90+
}
91+
92+
void test5_8(DOMImplementationLS *impl, InputSource &data) {
93+
DOMLSParser *p = impl->createLSParser();
94+
DOMConfiguration *cfg = p->getDomConfig();
95+
96+
p->parse(data); // BAD (parser not correctly configured) [NOT DETECTED]
97+
98+
cfg->setParameter(XMLUni::fgXercesDisableDefaultEntityResolution, true);
99+
p->parse(data); // GOOD
100+
101+
cfg->setParameter(XMLUni::fgXercesDisableDefaultEntityResolution, false);
102+
p->parse(data); // BAD (parser not correctly configured) [NOT DETECTED]
103+
}

0 commit comments

Comments
 (0)