From 01bcb23de156b2b9bb3a247ff203e5e070fc53b7 Mon Sep 17 00:00:00 2001 From: Nick Wellnhofer Date: Wed, 21 Dec 2022 01:01:36 +0100 Subject: [PATCH] testrecurse: Add test cases for external entities Add test cases for external general and parameter entities. --- test/recurse/g0.ent | 4 ++++ test/recurse/g1.ent | 4 ++++ test/recurse/g2.ent | 4 ++++ test/recurse/g3.ent | 4 ++++ test/recurse/lol_eg.xml | 9 +++++++++ test/recurse/lol_ep.xml | 10 ++++++++++ test/recurse/lol_ip_content.dtd | 9 +++++++++ test/recurse/lol_ip_content.xml | 3 +++ test/recurse/p0.ent | 4 ++++ test/recurse/p1.ent | 4 ++++ test/recurse/p2.ent | 4 ++++ test/recurse/p3.ent | 4 ++++ testrecurse.c | 7 ++++++- 13 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 test/recurse/g0.ent create mode 100644 test/recurse/g1.ent create mode 100644 test/recurse/g2.ent create mode 100644 test/recurse/g3.ent create mode 100644 test/recurse/lol_eg.xml create mode 100644 test/recurse/lol_ep.xml create mode 100644 test/recurse/lol_ip_content.dtd create mode 100644 test/recurse/lol_ip_content.xml create mode 100644 test/recurse/p0.ent create mode 100644 test/recurse/p1.ent create mode 100644 test/recurse/p2.ent create mode 100644 test/recurse/p3.ent diff --git a/test/recurse/g0.ent b/test/recurse/g0.ent new file mode 100644 index 00000000..46832f1e --- /dev/null +++ b/test/recurse/g0.ent @@ -0,0 +1,4 @@ +hahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahaha +hahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahaha +hahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahaha +hahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahaha diff --git a/test/recurse/g1.ent b/test/recurse/g1.ent new file mode 100644 index 00000000..e64e6928 --- /dev/null +++ b/test/recurse/g1.ent @@ -0,0 +1,4 @@ +&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0; +&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0; +&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0; +&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0; diff --git a/test/recurse/g2.ent b/test/recurse/g2.ent new file mode 100644 index 00000000..16a80bb6 --- /dev/null +++ b/test/recurse/g2.ent @@ -0,0 +1,4 @@ +&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1; +&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1; +&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1; +&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1; diff --git a/test/recurse/g3.ent b/test/recurse/g3.ent new file mode 100644 index 00000000..6407723d --- /dev/null +++ b/test/recurse/g3.ent @@ -0,0 +1,4 @@ +&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2; +&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2; +&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2; +&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2; diff --git a/test/recurse/lol_eg.xml b/test/recurse/lol_eg.xml new file mode 100644 index 00000000..2f8940b7 --- /dev/null +++ b/test/recurse/lol_eg.xml @@ -0,0 +1,9 @@ + + + + + + +]> +&g3; diff --git a/test/recurse/lol_ep.xml b/test/recurse/lol_ep.xml new file mode 100644 index 00000000..705437c2 --- /dev/null +++ b/test/recurse/lol_ep.xml @@ -0,0 +1,10 @@ + + + + + + + %p3; +]> + diff --git a/test/recurse/lol_ip_content.dtd b/test/recurse/lol_ip_content.dtd new file mode 100644 index 00000000..fca54b66 --- /dev/null +++ b/test/recurse/lol_ip_content.dtd @@ -0,0 +1,9 @@ + +"> + + + + + + +%p5; diff --git a/test/recurse/lol_ip_content.xml b/test/recurse/lol_ip_content.xml new file mode 100644 index 00000000..4e6f4c5f --- /dev/null +++ b/test/recurse/lol_ip_content.xml @@ -0,0 +1,3 @@ + + + diff --git a/test/recurse/p0.ent b/test/recurse/p0.ent new file mode 100644 index 00000000..82e12925 --- /dev/null +++ b/test/recurse/p0.ent @@ -0,0 +1,4 @@ + + + + diff --git a/test/recurse/p1.ent b/test/recurse/p1.ent new file mode 100644 index 00000000..9a21bb5c --- /dev/null +++ b/test/recurse/p1.ent @@ -0,0 +1,4 @@ +%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0; +%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0; +%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0; +%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0; diff --git a/test/recurse/p2.ent b/test/recurse/p2.ent new file mode 100644 index 00000000..f45c306d --- /dev/null +++ b/test/recurse/p2.ent @@ -0,0 +1,4 @@ +%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1; +%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1; +%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1; +%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1; diff --git a/test/recurse/p3.ent b/test/recurse/p3.ent new file mode 100644 index 00000000..139d47a6 --- /dev/null +++ b/test/recurse/p3.ent @@ -0,0 +1,4 @@ +%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2; +%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2; +%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2; +%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2; diff --git a/testrecurse.c b/testrecurse.c index de25ed9c..77a9595d 100644 --- a/testrecurse.c +++ b/testrecurse.c @@ -687,7 +687,12 @@ recursiveDetectTest(const char *filename, xmlDocPtr doc; xmlParserCtxtPtr ctxt; int res = 0; - int parserOptions = XML_PARSE_DTDLOAD; + /* + * XML_PARSE_DTDVALID is the only way to load external entities + * without XML_PARSE_NOENT. The validation result doesn't matter + * anyway. + */ + int parserOptions = XML_PARSE_DTDVALID; nb_tests++;