diff options
author | Nick Wellnhofer <wellnhofer@aevum.de> | 2019-09-30 13:50:02 +0200 |
---|---|---|
committer | Nick Wellnhofer <wellnhofer@aevum.de> | 2019-09-30 15:47:30 +0200 |
commit | c51e38cb3a808e315248e03c9e52bce08943c22b (patch) | |
tree | b88e6fcd314378026d6b85e326334e47d8cc3cb2 /test | |
parent | 9d461ac7d097fc9d0ac2e947b2796d9e189c7e81 (diff) | |
download | libxml2-c51e38cb3a808e315248e03c9e52bce08943c22b.tar.gz |
Make xmlParseConditionalSections non-recursive
Avoid call stack overflow in deeply nested conditional sections.
Found by OSS-Fuzz.
Diffstat (limited to 'test')
-rw-r--r-- | test/valid/cond_sect1.xml | 7 | ||||
-rw-r--r-- | test/valid/cond_sect2.xml | 4 | ||||
-rw-r--r-- | test/valid/dtds/cond_sect1.dtd | 20 | ||||
-rw-r--r-- | test/valid/dtds/cond_sect2.dtd | 16 |
4 files changed, 47 insertions, 0 deletions
diff --git a/test/valid/cond_sect1.xml b/test/valid/cond_sect1.xml new file mode 100644 index 00000000..796faa43 --- /dev/null +++ b/test/valid/cond_sect1.xml @@ -0,0 +1,7 @@ +<!DOCTYPE doc SYSTEM "dtds/cond_sect1.dtd" [ + <!ENTITY % include "INCLUDE"> + <!ENTITY % ignore "IGNORE"> +]> +<doc> + <child>text</child> +</doc> diff --git a/test/valid/cond_sect2.xml b/test/valid/cond_sect2.xml new file mode 100644 index 00000000..5153d053 --- /dev/null +++ b/test/valid/cond_sect2.xml @@ -0,0 +1,4 @@ +<!DOCTYPE doc SYSTEM "dtds/cond_sect2.dtd"> +<doc> + <child>text</child> +</doc> diff --git a/test/valid/dtds/cond_sect1.dtd b/test/valid/dtds/cond_sect1.dtd new file mode 100644 index 00000000..e3270229 --- /dev/null +++ b/test/valid/dtds/cond_sect1.dtd @@ -0,0 +1,20 @@ +<![ %include; [ + <![%include; [ + <![ %include;[ + <![%include;[ + <!ELEMENT doc (child)> + <!ELEMENT child (#PCDATA)> + ]]> + ]]> + ]]> +]]> +<![ %ignore; [ + <![%include; [ + <![ %include;[ + <![%ignore;[ + <!ELEMENT doc (x)> + <!ELEMENT child (y)> + ]]> + ]]> + ]]> +]]> diff --git a/test/valid/dtds/cond_sect2.dtd b/test/valid/dtds/cond_sect2.dtd new file mode 100644 index 00000000..29eb4bfe --- /dev/null +++ b/test/valid/dtds/cond_sect2.dtd @@ -0,0 +1,16 @@ +<!ENTITY % ent "]]>"> +<![INCLUDE[ + <![INCLUDE[ + <![INCLUDE[ + <![INCLUDE[ + <![INCLUDE[ + <![INCLUDE[ + <![INCLUDE[ + <![INCLUDE[ + ]]> + ]]> + ]]> + ]]> + ]]> + %ent; +]]> |