mirror of
https://github.com/libexpat/libexpat.git
synced 2025-04-05 13:14:59 +00:00
Mass-apply clang-format 17.0.3 using ./apply-clang-format.sh
This commit is contained in:
parent
55fecd6aa4
commit
ac14808b26
1 changed files with 162 additions and 162 deletions
|
@ -57,183 +57,183 @@
|
|||
#if XML_GE == 1
|
||||
START_TEST(test_accounting_precision) {
|
||||
struct AccountingTestCase cases[] = {
|
||||
{"<e/>", NULL, NULL, 0},
|
||||
{"<e></e>", NULL, NULL, 0},
|
||||
{"<e/>", NULL, NULL, 0},
|
||||
{"<e></e>", NULL, NULL, 0},
|
||||
|
||||
/* Attributes */
|
||||
{"<e k1=\"v2\" k2=\"v2\"/>", NULL, NULL, 0},
|
||||
{"<e k1=\"v2\" k2=\"v2\"></e>", NULL, NULL, 0},
|
||||
{"<p:e xmlns:p=\"https://domain.invalid/\" />", NULL, NULL, 0},
|
||||
{"<e k=\"&'><"\" />", NULL, NULL,
|
||||
sizeof(XML_Char) * 5 /* number of predefined entities */},
|
||||
{"<e1 xmlns='https://example.org/'>\n"
|
||||
" <e2 xmlns=''/>\n"
|
||||
"</e1>",
|
||||
NULL, NULL, 0},
|
||||
/* Attributes */
|
||||
{"<e k1=\"v2\" k2=\"v2\"/>", NULL, NULL, 0},
|
||||
{"<e k1=\"v2\" k2=\"v2\"></e>", NULL, NULL, 0},
|
||||
{"<p:e xmlns:p=\"https://domain.invalid/\" />", NULL, NULL, 0},
|
||||
{"<e k=\"&'><"\" />", NULL, NULL,
|
||||
sizeof(XML_Char) * 5 /* number of predefined entities */},
|
||||
{"<e1 xmlns='https://example.org/'>\n"
|
||||
" <e2 xmlns=''/>\n"
|
||||
"</e1>",
|
||||
NULL, NULL, 0},
|
||||
|
||||
/* Text */
|
||||
{"<e>text</e>", NULL, NULL, 0},
|
||||
{"<e1><e2>text1<e3/>text2</e2></e1>", NULL, NULL, 0},
|
||||
{"<e>&'><"</e>", NULL, NULL,
|
||||
sizeof(XML_Char) * 5 /* number of predefined entities */},
|
||||
{"<e>A)</e>", NULL, NULL, 0},
|
||||
/* Text */
|
||||
{"<e>text</e>", NULL, NULL, 0},
|
||||
{"<e1><e2>text1<e3/>text2</e2></e1>", NULL, NULL, 0},
|
||||
{"<e>&'><"</e>", NULL, NULL,
|
||||
sizeof(XML_Char) * 5 /* number of predefined entities */},
|
||||
{"<e>A)</e>", NULL, NULL, 0},
|
||||
|
||||
/* Prolog */
|
||||
{"<?xml version=\"1.0\"?><root/>", NULL, NULL, 0},
|
||||
/* Prolog */
|
||||
{"<?xml version=\"1.0\"?><root/>", NULL, NULL, 0},
|
||||
|
||||
/* Whitespace */
|
||||
{" <e1> <e2> </e2> </e1> ", NULL, NULL, 0},
|
||||
{"<e1 ><e2 /></e1 >", NULL, NULL, 0},
|
||||
{"<e1><e2 k = \"v\"/><e3 k = 'v'/></e1>", NULL, NULL, 0},
|
||||
/* Whitespace */
|
||||
{" <e1> <e2> </e2> </e1> ", NULL, NULL, 0},
|
||||
{"<e1 ><e2 /></e1 >", NULL, NULL, 0},
|
||||
{"<e1><e2 k = \"v\"/><e3 k = 'v'/></e1>", NULL, NULL, 0},
|
||||
|
||||
/* Comments */
|
||||
{"<!-- Comment --><e><!-- Comment --></e>", NULL, NULL, 0},
|
||||
/* Comments */
|
||||
{"<!-- Comment --><e><!-- Comment --></e>", NULL, NULL, 0},
|
||||
|
||||
/* Processing instructions */
|
||||
{"<?xml-stylesheet type=\"text/xsl\" href=\"https://domain.invalid/\" media=\"all\"?><e/>",
|
||||
NULL, NULL, 0},
|
||||
{"<?pi0?><?pi1 ?><?pi2 ?><r/><?pi4?>", NULL, NULL, 0},
|
||||
/* Processing instructions */
|
||||
{"<?xml-stylesheet type=\"text/xsl\" href=\"https://domain.invalid/\" media=\"all\"?><e/>",
|
||||
NULL, NULL, 0},
|
||||
{"<?pi0?><?pi1 ?><?pi2 ?><r/><?pi4?>", NULL, NULL, 0},
|
||||
# ifdef XML_DTD
|
||||
{"<?pi0?><?pi1 ?><?pi2 ?><!DOCTYPE r SYSTEM 'first.ent'><r/>",
|
||||
"<?pi3?><!ENTITY % e1 SYSTEM 'second.ent'><?pi4?>%e1;<?pi5?>", "<?pi6?>",
|
||||
0},
|
||||
{"<?pi0?><?pi1 ?><?pi2 ?><!DOCTYPE r SYSTEM 'first.ent'><r/>",
|
||||
"<?pi3?><!ENTITY % e1 SYSTEM 'second.ent'><?pi4?>%e1;<?pi5?>", "<?pi6?>",
|
||||
0},
|
||||
# endif /* XML_DTD */
|
||||
|
||||
/* CDATA */
|
||||
{"<e><![CDATA[one two three]]></e>", NULL, NULL, 0},
|
||||
/* The following is the essence of this OSS-Fuzz finding:
|
||||
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=34302
|
||||
https://oss-fuzz.com/testcase-detail/4860575394955264
|
||||
*/
|
||||
{"<!DOCTYPE r [\n"
|
||||
"<!ENTITY e \"111<![CDATA[2 <= 2]]>333\">\n"
|
||||
"]>\n"
|
||||
"<r>&e;</r>\n",
|
||||
NULL, NULL, sizeof(XML_Char) * strlen("111<![CDATA[2 <= 2]]>333")},
|
||||
/* CDATA */
|
||||
{"<e><![CDATA[one two three]]></e>", NULL, NULL, 0},
|
||||
/* The following is the essence of this OSS-Fuzz finding:
|
||||
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=34302
|
||||
https://oss-fuzz.com/testcase-detail/4860575394955264
|
||||
*/
|
||||
{"<!DOCTYPE r [\n"
|
||||
"<!ENTITY e \"111<![CDATA[2 <= 2]]>333\">\n"
|
||||
"]>\n"
|
||||
"<r>&e;</r>\n",
|
||||
NULL, NULL, sizeof(XML_Char) * strlen("111<![CDATA[2 <= 2]]>333")},
|
||||
|
||||
# ifdef XML_DTD
|
||||
/* Conditional sections */
|
||||
{"<!DOCTYPE r [\n"
|
||||
"<!ENTITY % draft 'INCLUDE'>\n"
|
||||
"<!ENTITY % final 'IGNORE'>\n"
|
||||
"<!ENTITY % import SYSTEM \"first.ent\">\n"
|
||||
"%import;\n"
|
||||
"]>\n"
|
||||
"<r/>\n",
|
||||
"<![%draft;[<!--1-->]]>\n"
|
||||
"<![%final;[<!--22-->]]>",
|
||||
NULL, sizeof(XML_Char) * (strlen("INCLUDE") + strlen("IGNORE"))},
|
||||
/* Conditional sections */
|
||||
{"<!DOCTYPE r [\n"
|
||||
"<!ENTITY % draft 'INCLUDE'>\n"
|
||||
"<!ENTITY % final 'IGNORE'>\n"
|
||||
"<!ENTITY % import SYSTEM \"first.ent\">\n"
|
||||
"%import;\n"
|
||||
"]>\n"
|
||||
"<r/>\n",
|
||||
"<![%draft;[<!--1-->]]>\n"
|
||||
"<![%final;[<!--22-->]]>",
|
||||
NULL, sizeof(XML_Char) * (strlen("INCLUDE") + strlen("IGNORE"))},
|
||||
# endif /* XML_DTD */
|
||||
|
||||
/* General entities */
|
||||
{"<!DOCTYPE root [\n"
|
||||
"<!ENTITY nine \"123456789\">\n"
|
||||
"]>\n"
|
||||
"<root>&nine;</root>",
|
||||
NULL, NULL, sizeof(XML_Char) * strlen("123456789")},
|
||||
{"<!DOCTYPE root [\n"
|
||||
"<!ENTITY nine \"123456789\">\n"
|
||||
"]>\n"
|
||||
"<root k1=\"&nine;\"/>",
|
||||
NULL, NULL, sizeof(XML_Char) * strlen("123456789")},
|
||||
{"<!DOCTYPE root [\n"
|
||||
"<!ENTITY nine \"123456789\">\n"
|
||||
"<!ENTITY nine2 \"&nine;&nine;\">\n"
|
||||
"]>\n"
|
||||
"<root>&nine2;&nine2;&nine2;</root>",
|
||||
NULL, NULL,
|
||||
sizeof(XML_Char) * 3 /* calls to &nine2; */ * 2 /* calls to &nine; */
|
||||
* (strlen("&nine;") + strlen("123456789"))},
|
||||
{"<!DOCTYPE r [\n"
|
||||
" <!ENTITY five SYSTEM 'first.ent'>\n"
|
||||
"]>\n"
|
||||
"<r>&five;</r>",
|
||||
"12345", NULL, 0},
|
||||
{"<!DOCTYPE r [\n"
|
||||
" <!ENTITY five SYSTEM 'first.ent'>\n"
|
||||
"]>\n"
|
||||
"<r>&five;</r>",
|
||||
"\xEF\xBB\xBF" /* UTF-8 BOM */, NULL, 0},
|
||||
/* General entities */
|
||||
{"<!DOCTYPE root [\n"
|
||||
"<!ENTITY nine \"123456789\">\n"
|
||||
"]>\n"
|
||||
"<root>&nine;</root>",
|
||||
NULL, NULL, sizeof(XML_Char) * strlen("123456789")},
|
||||
{"<!DOCTYPE root [\n"
|
||||
"<!ENTITY nine \"123456789\">\n"
|
||||
"]>\n"
|
||||
"<root k1=\"&nine;\"/>",
|
||||
NULL, NULL, sizeof(XML_Char) * strlen("123456789")},
|
||||
{"<!DOCTYPE root [\n"
|
||||
"<!ENTITY nine \"123456789\">\n"
|
||||
"<!ENTITY nine2 \"&nine;&nine;\">\n"
|
||||
"]>\n"
|
||||
"<root>&nine2;&nine2;&nine2;</root>",
|
||||
NULL, NULL,
|
||||
sizeof(XML_Char) * 3 /* calls to &nine2; */ * 2 /* calls to &nine; */
|
||||
* (strlen("&nine;") + strlen("123456789"))},
|
||||
{"<!DOCTYPE r [\n"
|
||||
" <!ENTITY five SYSTEM 'first.ent'>\n"
|
||||
"]>\n"
|
||||
"<r>&five;</r>",
|
||||
"12345", NULL, 0},
|
||||
{"<!DOCTYPE r [\n"
|
||||
" <!ENTITY five SYSTEM 'first.ent'>\n"
|
||||
"]>\n"
|
||||
"<r>&five;</r>",
|
||||
"\xEF\xBB\xBF" /* UTF-8 BOM */, NULL, 0},
|
||||
|
||||
# ifdef XML_DTD
|
||||
/* Parameter entities */
|
||||
{"<!DOCTYPE r [\n"
|
||||
"<!ENTITY % comment \"<!---->\">\n"
|
||||
"%comment;\n"
|
||||
"]>\n"
|
||||
"<r/>",
|
||||
NULL, NULL, sizeof(XML_Char) * strlen("<!---->")},
|
||||
{"<!DOCTYPE r [\n"
|
||||
"<!ENTITY % ninedef \"<!ENTITY nine "123456789">\">\n"
|
||||
"%ninedef;\n"
|
||||
"]>\n"
|
||||
"<r>&nine;</r>",
|
||||
NULL, NULL,
|
||||
sizeof(XML_Char)
|
||||
* (strlen("<!ENTITY nine \"123456789\">") + strlen("123456789"))},
|
||||
{"<!DOCTYPE r [\n"
|
||||
"<!ENTITY % comment \"<!--1-->\">\n"
|
||||
"<!ENTITY % comment2 \"%comment;<!--22-->%comment;\">\n"
|
||||
"%comment2;\n"
|
||||
"]>\n"
|
||||
"<r/>\n",
|
||||
NULL, NULL,
|
||||
sizeof(XML_Char)
|
||||
* (strlen("%comment;<!--22-->%comment;") + 2 * strlen("<!--1-->"))},
|
||||
{"<!DOCTYPE r [\n"
|
||||
" <!ENTITY % five \"12345\">\n"
|
||||
" <!ENTITY % five2def \"<!ENTITY five2 "[%five;][%five;]]]]">\">\n"
|
||||
" %five2def;\n"
|
||||
"]>\n"
|
||||
"<r>&five2;</r>",
|
||||
NULL, NULL, /* from "%five2def;": */
|
||||
sizeof(XML_Char)
|
||||
* (strlen("<!ENTITY five2 \"[%five;][%five;]]]]\">")
|
||||
+ 2 /* calls to "%five;" */ * strlen("12345")
|
||||
+ /* from "&five2;": */ strlen("[12345][12345]]]]"))},
|
||||
{"<!DOCTYPE r SYSTEM \"first.ent\">\n"
|
||||
"<r/>",
|
||||
"<!ENTITY % comment '<!--1-->'>\n"
|
||||
"<!ENTITY % comment2 '<!--22-->%comment;<!--22-->%comment;<!--22-->'>\n"
|
||||
"%comment2;",
|
||||
NULL,
|
||||
sizeof(XML_Char)
|
||||
* (strlen("<!--22-->%comment;<!--22-->%comment;<!--22-->")
|
||||
+ 2 /* calls to "%comment;" */ * strlen("<!---->"))},
|
||||
{"<!DOCTYPE r SYSTEM 'first.ent'>\n"
|
||||
"<r/>",
|
||||
"<!ENTITY % e1 PUBLIC 'foo' 'second.ent'>\n"
|
||||
"<!ENTITY % e2 '<!--22-->%e1;<!--22-->'>\n"
|
||||
"%e2;\n",
|
||||
"<!--1-->", sizeof(XML_Char) * strlen("<!--22--><!--1--><!--22-->")},
|
||||
{
|
||||
"<!DOCTYPE r SYSTEM 'first.ent'>\n"
|
||||
"<r/>",
|
||||
"<!ENTITY % e1 SYSTEM 'second.ent'>\n"
|
||||
"<!ENTITY % e2 '%e1;'>",
|
||||
"<?xml version='1.0' encoding='utf-8'?>\n"
|
||||
"hello\n"
|
||||
"xml" /* without trailing newline! */,
|
||||
0,
|
||||
},
|
||||
{
|
||||
"<!DOCTYPE r SYSTEM 'first.ent'>\n"
|
||||
"<r/>",
|
||||
"<!ENTITY % e1 SYSTEM 'second.ent'>\n"
|
||||
"<!ENTITY % e2 '%e1;'>",
|
||||
"<?xml version='1.0' encoding='utf-8'?>\n"
|
||||
"hello\n"
|
||||
"xml\n" /* with trailing newline! */,
|
||||
0,
|
||||
},
|
||||
{"<!DOCTYPE doc SYSTEM 'first.ent'>\n"
|
||||
"<doc></doc>\n",
|
||||
"<!ELEMENT doc EMPTY>\n"
|
||||
"<!ENTITY % e1 SYSTEM 'second.ent'>\n"
|
||||
"<!ENTITY % e2 '%e1;'>\n"
|
||||
"%e1;\n",
|
||||
"\xEF\xBB\xBF<!ATTLIST doc a1 CDATA 'value'>" /* UTF-8 BOM */,
|
||||
strlen("\xEF\xBB\xBF<!ATTLIST doc a1 CDATA 'value'>")},
|
||||
/* Parameter entities */
|
||||
{"<!DOCTYPE r [\n"
|
||||
"<!ENTITY % comment \"<!---->\">\n"
|
||||
"%comment;\n"
|
||||
"]>\n"
|
||||
"<r/>",
|
||||
NULL, NULL, sizeof(XML_Char) * strlen("<!---->")},
|
||||
{"<!DOCTYPE r [\n"
|
||||
"<!ENTITY % ninedef \"<!ENTITY nine "123456789">\">\n"
|
||||
"%ninedef;\n"
|
||||
"]>\n"
|
||||
"<r>&nine;</r>",
|
||||
NULL, NULL,
|
||||
sizeof(XML_Char)
|
||||
* (strlen("<!ENTITY nine \"123456789\">") + strlen("123456789"))},
|
||||
{"<!DOCTYPE r [\n"
|
||||
"<!ENTITY % comment \"<!--1-->\">\n"
|
||||
"<!ENTITY % comment2 \"%comment;<!--22-->%comment;\">\n"
|
||||
"%comment2;\n"
|
||||
"]>\n"
|
||||
"<r/>\n",
|
||||
NULL, NULL,
|
||||
sizeof(XML_Char)
|
||||
* (strlen("%comment;<!--22-->%comment;") + 2 * strlen("<!--1-->"))},
|
||||
{"<!DOCTYPE r [\n"
|
||||
" <!ENTITY % five \"12345\">\n"
|
||||
" <!ENTITY % five2def \"<!ENTITY five2 "[%five;][%five;]]]]">\">\n"
|
||||
" %five2def;\n"
|
||||
"]>\n"
|
||||
"<r>&five2;</r>",
|
||||
NULL, NULL, /* from "%five2def;": */
|
||||
sizeof(XML_Char)
|
||||
* (strlen("<!ENTITY five2 \"[%five;][%five;]]]]\">")
|
||||
+ 2 /* calls to "%five;" */ * strlen("12345")
|
||||
+ /* from "&five2;": */ strlen("[12345][12345]]]]"))},
|
||||
{"<!DOCTYPE r SYSTEM \"first.ent\">\n"
|
||||
"<r/>",
|
||||
"<!ENTITY % comment '<!--1-->'>\n"
|
||||
"<!ENTITY % comment2 '<!--22-->%comment;<!--22-->%comment;<!--22-->'>\n"
|
||||
"%comment2;",
|
||||
NULL,
|
||||
sizeof(XML_Char)
|
||||
* (strlen("<!--22-->%comment;<!--22-->%comment;<!--22-->")
|
||||
+ 2 /* calls to "%comment;" */ * strlen("<!---->"))},
|
||||
{"<!DOCTYPE r SYSTEM 'first.ent'>\n"
|
||||
"<r/>",
|
||||
"<!ENTITY % e1 PUBLIC 'foo' 'second.ent'>\n"
|
||||
"<!ENTITY % e2 '<!--22-->%e1;<!--22-->'>\n"
|
||||
"%e2;\n",
|
||||
"<!--1-->", sizeof(XML_Char) * strlen("<!--22--><!--1--><!--22-->")},
|
||||
{
|
||||
"<!DOCTYPE r SYSTEM 'first.ent'>\n"
|
||||
"<r/>",
|
||||
"<!ENTITY % e1 SYSTEM 'second.ent'>\n"
|
||||
"<!ENTITY % e2 '%e1;'>",
|
||||
"<?xml version='1.0' encoding='utf-8'?>\n"
|
||||
"hello\n"
|
||||
"xml" /* without trailing newline! */,
|
||||
0,
|
||||
},
|
||||
{
|
||||
"<!DOCTYPE r SYSTEM 'first.ent'>\n"
|
||||
"<r/>",
|
||||
"<!ENTITY % e1 SYSTEM 'second.ent'>\n"
|
||||
"<!ENTITY % e2 '%e1;'>",
|
||||
"<?xml version='1.0' encoding='utf-8'?>\n"
|
||||
"hello\n"
|
||||
"xml\n" /* with trailing newline! */,
|
||||
0,
|
||||
},
|
||||
{"<!DOCTYPE doc SYSTEM 'first.ent'>\n"
|
||||
"<doc></doc>\n",
|
||||
"<!ELEMENT doc EMPTY>\n"
|
||||
"<!ENTITY % e1 SYSTEM 'second.ent'>\n"
|
||||
"<!ENTITY % e2 '%e1;'>\n"
|
||||
"%e1;\n",
|
||||
"\xEF\xBB\xBF<!ATTLIST doc a1 CDATA 'value'>" /* UTF-8 BOM */,
|
||||
strlen("\xEF\xBB\xBF<!ATTLIST doc a1 CDATA 'value'>")},
|
||||
# endif /* XML_DTD */
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue