mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-01-12 09:17:37 +03:00
parser: Halt parser on DTD errors
If we try to continue parsing after an error in the internal or external subset, entity expansion accounting gets more complicated. Simply halt the parser. Found with libFuzzer.
This commit is contained in:
parent
d9a8dab3a3
commit
74aa61e0bd
9
parser.c
9
parser.c
@ -7143,7 +7143,8 @@ xmlParseExternalSubset(xmlParserCtxtPtr ctxt, const xmlChar *ExternalID,
|
||||
xmlParseMarkupDecl(ctxt);
|
||||
} else {
|
||||
xmlFatalErr(ctxt, XML_ERR_EXT_SUBSET_NOT_FINISHED, NULL);
|
||||
break;
|
||||
xmlHaltParser(ctxt);
|
||||
return;
|
||||
}
|
||||
SKIP_BLANKS;
|
||||
}
|
||||
@ -8481,10 +8482,8 @@ xmlParseInternalSubset(xmlParserCtxtPtr ctxt) {
|
||||
xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR,
|
||||
"xmlParseInternalSubset: error detected in"
|
||||
" Markup declaration\n");
|
||||
if (ctxt->inputNr > baseInputNr)
|
||||
xmlPopInput(ctxt);
|
||||
else
|
||||
break;
|
||||
xmlHaltParser(ctxt);
|
||||
return;
|
||||
}
|
||||
SKIP_BLANKS;
|
||||
}
|
||||
|
@ -69,20 +69,6 @@ Entity: line 1:
|
||||
Entity: line 1:
|
||||
<!ELEMENT root (middle) >
|
||||
^
|
||||
{0}/t8.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
|
||||
|
||||
%defroot; %defmiddle; %deftest;
|
||||
^
|
||||
Entity: line 1:
|
||||
<!ELEMENT middle (test) >
|
||||
^
|
||||
{0}/t8.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
|
||||
|
||||
%defroot; %defmiddle; %deftest;
|
||||
^
|
||||
Entity: line 1:
|
||||
<!ELEMENT test (#PCDATA) >
|
||||
^
|
||||
""".format(dir_prefix),
|
||||
't8a':
|
||||
"""{0}/t8a.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
|
||||
@ -92,20 +78,6 @@ Entity: line 1:
|
||||
Entity: line 1:
|
||||
<!ELEMENT root (middle) >
|
||||
^
|
||||
{0}/t8a.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
|
||||
|
||||
%defroot;%defmiddle;%deftest;
|
||||
^
|
||||
Entity: line 1:
|
||||
<!ELEMENT middle (test) >
|
||||
^
|
||||
{0}/t8a.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
|
||||
|
||||
%defroot;%defmiddle;%deftest;
|
||||
^
|
||||
Entity: line 1:
|
||||
<!ELEMENT test (#PCDATA) >
|
||||
^
|
||||
""".format(dir_prefix),
|
||||
'xlink':
|
||||
"""{0}/xlink.xml:450: element termdef: validity error : ID dt-arc already defined
|
||||
|
@ -5,13 +5,3 @@
|
||||
Entity: line 1:
|
||||
A<lbbbbbbbbbbbbbbbbbbb_
|
||||
^
|
||||
./test/errors/754946.xml:4: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
|
||||
|
||||
<![
|
||||
^
|
||||
./test/errors/754946.xml:4: parser error : DOCTYPE improperly terminated
|
||||
<![
|
||||
^
|
||||
./test/errors/754946.xml:4: parser error : Start tag expected, '<' not found
|
||||
<![
|
||||
^
|
||||
|
@ -5,13 +5,3 @@
|
||||
Entity: line 1:
|
||||
A<lbbbbbbbbbbbbbbbbbbb_
|
||||
^
|
||||
./test/errors/754946.xml:4: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
|
||||
|
||||
<![
|
||||
^
|
||||
./test/errors/754946.xml:4: parser error : DOCTYPE improperly terminated
|
||||
<![
|
||||
^
|
||||
./test/errors/754946.xml:4: parser error : Start tag expected, '<' not found
|
||||
<![
|
||||
^
|
||||
|
@ -5,11 +5,4 @@
|
||||
Entity: line 1:
|
||||
A<lbbbbbbbbbbbbbbbbbbb_
|
||||
^
|
||||
./test/errors/754946.xml:4: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
|
||||
|
||||
<![
|
||||
^
|
||||
./test/errors/754946.xml:4: parser error : DOCTYPE improperly terminated
|
||||
<![
|
||||
^
|
||||
./test/errors/754946.xml : failed to parse
|
||||
|
@ -23,13 +23,3 @@ Entity: line 1:
|
||||
Entity: line 2:
|
||||
<![INCLUDE[
|
||||
^
|
||||
./test/errors/759573-2.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
|
||||
|
||||
%xx;
|
||||
^
|
||||
./test/errors/759573-2.xml:6: parser error : DOCTYPE improperly terminated
|
||||
%xx;
|
||||
^
|
||||
./test/errors/759573-2.xml:6: parser error : Start tag expected, '<' not found
|
||||
%xx;
|
||||
^
|
||||
|
@ -23,13 +23,3 @@ Entity: line 1:
|
||||
Entity: line 2:
|
||||
<![INCLUDE[
|
||||
^
|
||||
./test/errors/759573-2.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
|
||||
|
||||
%xx;
|
||||
^
|
||||
./test/errors/759573-2.xml:6: parser error : DOCTYPE improperly terminated
|
||||
%xx;
|
||||
^
|
||||
./test/errors/759573-2.xml:6: parser error : Start tag expected, '<' not found
|
||||
%xx;
|
||||
^
|
||||
|
@ -23,11 +23,4 @@ Entity: line 1:
|
||||
Entity: line 2:
|
||||
<![INCLUDE[
|
||||
^
|
||||
./test/errors/759573-2.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
|
||||
|
||||
%xx;
|
||||
^
|
||||
./test/errors/759573-2.xml:6: parser error : DOCTYPE improperly terminated
|
||||
%xx;
|
||||
^
|
||||
./test/errors/759573-2.xml : failed to parse
|
||||
|
@ -20,13 +20,3 @@ T t (A)><!ENTITY % xx '%<![INCLUDE[000%ஸ000%z;'><!ENTITYz>%xx;
|
||||
Entity: line 1:
|
||||
%<![INCLUDE[000%ஸ000%z;
|
||||
^
|
||||
./test/errors/759573.xml:1: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
|
||||
|
||||
T t (A)><!ENTITY % xx '%<![INCLUDE[000%ஸ000%z;'><!ENTITYz>%xx;
|
||||
^
|
||||
./test/errors/759573.xml:1: parser error : DOCTYPE improperly terminated
|
||||
T t (A)><!ENTITY % xx '%<![INCLUDE[000%ஸ000%z;'><!ENTITYz>%xx;
|
||||
^
|
||||
./test/errors/759573.xml:1: parser error : Start tag expected, '<' not found
|
||||
T t (A)><!ENTITY % xx '%<![INCLUDE[000%ஸ000%z;'><!ENTITYz>%xx;
|
||||
^
|
||||
|
@ -20,13 +20,3 @@ T t (A)><!ENTITY % xx '%<![INCLUDE[000%ஸ000%z;'><!ENTITYz>%xx;
|
||||
Entity: line 1:
|
||||
%<![INCLUDE[000%ஸ000%z;
|
||||
^
|
||||
./test/errors/759573.xml:1: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
|
||||
|
||||
T t (A)><!ENTITY % xx '%<![INCLUDE[000%ஸ000%z;'><!ENTITYz>%xx;
|
||||
^
|
||||
./test/errors/759573.xml:1: parser error : DOCTYPE improperly terminated
|
||||
T t (A)><!ENTITY % xx '%<![INCLUDE[000%ஸ000%z;'><!ENTITYz>%xx;
|
||||
^
|
||||
./test/errors/759573.xml:1: parser error : Start tag expected, '<' not found
|
||||
T t (A)><!ENTITY % xx '%<![INCLUDE[000%ஸ000%z;'><!ENTITYz>%xx;
|
||||
^
|
||||
|
@ -20,11 +20,4 @@ T t (A)><!ENTITY % xx '%<![INCLUDE[000%ஸ000%z;'><!ENTITYz>%xx;
|
||||
Entity: line 1:
|
||||
%<![INCLUDE[000%ஸ000%z;
|
||||
^
|
||||
./test/errors/759573.xml:1: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
|
||||
|
||||
T t (A)><!ENTITY % xx '%<![INCLUDE[000%ஸ000%z;'><!ENTITYz>%xx;
|
||||
^
|
||||
./test/errors/759573.xml:1: parser error : DOCTYPE improperly terminated
|
||||
T t (A)><!ENTITY % xx '%<![INCLUDE[000%ஸ000%z;'><!ENTITYz>%xx;
|
||||
^
|
||||
./test/errors/759573.xml : failed to parse
|
||||
|
@ -8,9 +8,3 @@
|
||||
|
||||
<!ELEMENT aElement (a |b * >
|
||||
^
|
||||
./test/errors/content1.xml:7: parser error : DOCTYPE improperly terminated
|
||||
<!ELEMENT aElement (a |b * >
|
||||
^
|
||||
./test/errors/content1.xml:7: parser error : Start tag expected, '<' not found
|
||||
<!ELEMENT aElement (a |b * >
|
||||
^
|
||||
|
@ -8,9 +8,3 @@
|
||||
|
||||
<!ELEMENT aElement (a |b * >
|
||||
^
|
||||
./test/errors/content1.xml:7: parser error : DOCTYPE improperly terminated
|
||||
<!ELEMENT aElement (a |b * >
|
||||
^
|
||||
./test/errors/content1.xml:7: parser error : Start tag expected, '<' not found
|
||||
<!ELEMENT aElement (a |b * >
|
||||
^
|
||||
|
@ -6,9 +6,6 @@
|
||||
^
|
||||
./test/errors/content1.xml:7: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
|
||||
|
||||
<!ELEMENT aElement (a |b * >
|
||||
^
|
||||
./test/errors/content1.xml:7: parser error : DOCTYPE improperly terminated
|
||||
<!ELEMENT aElement (a |b * >
|
||||
^
|
||||
./test/errors/content1.xml : failed to parse
|
||||
|
@ -5,13 +5,3 @@
|
||||
Entity: line 1:
|
||||
<:0000
|
||||
^
|
||||
./test/errors10/781205.xml:4: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
|
||||
|
||||
|
||||
^
|
||||
./test/errors10/781205.xml:4: parser error : DOCTYPE improperly terminated
|
||||
|
||||
^
|
||||
./test/errors10/781205.xml:4: parser error : Start tag expected, '<' not found
|
||||
|
||||
^
|
||||
|
@ -4,10 +4,4 @@
|
||||
./test/errors10/781361.xml:4: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
|
||||
|
||||
|
||||
^
|
||||
./test/errors10/781361.xml:4: parser error : DOCTYPE improperly terminated
|
||||
|
||||
^
|
||||
./test/errors10/781361.xml:4: parser error : Start tag expected, '<' not found
|
||||
|
||||
^
|
||||
|
@ -5,17 +5,3 @@
|
||||
Entity: line 1:
|
||||
<!ELEMENT root (middle) >
|
||||
^
|
||||
./test/valid/t8.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
|
||||
|
||||
%defroot; %defmiddle; %deftest;
|
||||
^
|
||||
Entity: line 1:
|
||||
<!ELEMENT middle (test) >
|
||||
^
|
||||
./test/valid/t8.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
|
||||
|
||||
%defroot; %defmiddle; %deftest;
|
||||
^
|
||||
Entity: line 1:
|
||||
<!ELEMENT test (#PCDATA) >
|
||||
^
|
||||
|
@ -5,18 +5,4 @@
|
||||
Entity: line 1:
|
||||
<!ELEMENT root (middle) >
|
||||
^
|
||||
./test/valid/t8.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
|
||||
|
||||
%defroot; %defmiddle; %deftest;
|
||||
^
|
||||
Entity: line 1:
|
||||
<!ELEMENT middle (test) >
|
||||
^
|
||||
./test/valid/t8.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
|
||||
|
||||
%defroot; %defmiddle; %deftest;
|
||||
^
|
||||
Entity: line 1:
|
||||
<!ELEMENT test (#PCDATA) >
|
||||
^
|
||||
./test/valid/t8.xml : failed to parse
|
||||
|
@ -5,17 +5,3 @@
|
||||
Entity: line 1:
|
||||
<!ELEMENT root (middle) >
|
||||
^
|
||||
./test/valid/t8a.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
|
||||
|
||||
%defroot;%defmiddle;%deftest;
|
||||
^
|
||||
Entity: line 1:
|
||||
<!ELEMENT middle (test) >
|
||||
^
|
||||
./test/valid/t8a.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
|
||||
|
||||
%defroot;%defmiddle;%deftest;
|
||||
^
|
||||
Entity: line 1:
|
||||
<!ELEMENT test (#PCDATA) >
|
||||
^
|
||||
|
@ -5,18 +5,4 @@
|
||||
Entity: line 1:
|
||||
<!ELEMENT root (middle) >
|
||||
^
|
||||
./test/valid/t8a.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
|
||||
|
||||
%defroot;%defmiddle;%deftest;
|
||||
^
|
||||
Entity: line 1:
|
||||
<!ELEMENT middle (test) >
|
||||
^
|
||||
./test/valid/t8a.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
|
||||
|
||||
%defroot;%defmiddle;%deftest;
|
||||
^
|
||||
Entity: line 1:
|
||||
<!ELEMENT test (#PCDATA) >
|
||||
^
|
||||
./test/valid/t8a.xml : failed to parse
|
||||
|
Loading…
Reference in New Issue
Block a user