Commit c2f209c0 authored by Nick Wellnhofer's avatar Nick Wellnhofer

Disallow conditional sections in internal subset

Conditional sections are only allowed in *external* parameter entities
referenced from the internal subset.
parent c51e38cb
......@@ -8300,10 +8300,10 @@ xmlParseInternalSubset(xmlParserCtxtPtr ctxt) {
xmlParsePEReference(ctxt);
/*
* Conditional sections are allowed from entities included
* Conditional sections are allowed from external entities included
* by PE References in the internal subset.
*/
if ((ctxt->inputNr > 1) &&
if ((ctxt->inputNr > 1) && (ctxt->input->filename != NULL) &&
(RAW == '<') && (NXT(1) == '!') && (NXT(2) == '[')) {
xmlParseConditionalSections(ctxt);
}
......
......@@ -16,33 +16,20 @@ Entity: line 1: parser error : ParsePI: PI xDOCTYPEm space expected
Entity: line 1:
<!ENTITY<?xDOCTYPEm~?>
^
Entity: line 3: parser error : Space required after '<!ENTITY'
%zz;<!ELEMENTD(%MENT%MENTDŹMENTD%zNMT9KENSMYSYSTEM;MENT9%zz;
^
Entity: line 1:
<!ENTITY<?xDOCTYPEm~?>
^
Entity: line 3: parser error : xmlParseEntityDecl: no name
%zz;<!ELEMENTD(%MENT%MENTDŹMENTD%zNMT9KENSMYSYSTEM;MENT9%zz;
./test/errors/759573-2.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
%xx;ggKENSMYNT&#35;MENTD&#372zz;'>
^
Entity: line 1:
<!ENTITY<?xDOCTYPEm~?>
^
Entity: line 3: parser error : ParsePI: PI xDOCTYPEm space expected
%zz;<!ELEMENTD(%MENT%MENTDŹMENTD%zNMT9KENSMYSYSTEM;MENT9%zz;
Entity: line 2:
<![INCLUDE[
^
./test/errors/759573-2.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
%xx;ggKENSMYNT&#35;MENTD&#372zz;'>
^
Entity: line 1:
<!ENTITY<?xDOCTYPEm~?>
^
./test/errors/759573-2.xml:6: parser error : Space required after 'ELEMENT'
./test/errors/759573-2.xml:6: parser error : DOCTYPE improperly terminated
%xx;ggKENSMYNT&#35;MENTD&#372zz;'>
^
Entity: line 3:
%zz;<!ELEMENTD(%MENT%MENTDŹMENTD%zNMT9KENSMYSYSTEM;MENT9%zz;
^
./test/errors/759573-2.xml:6: parser error : Content error in the external subset
./test/errors/759573-2.xml:6: parser error : Start tag expected, '<' not found
%xx;ggKENSMYNT&#35;MENTD&#372zz;'>
^
Entity: line 3:
%zz;<!ELEMENTD(%MENT%MENTDŹMENTD%zNMT9KENSMYSYSTEM;MENT9%zz;
^
......@@ -13,9 +13,20 @@ T t (A)><!ENTITY % xx '&#37;<![INCLUDE[000&#37;&#3000;000&#37;z;'><!ENTITYz>%xx;
Entity: line 1:
%<![INCLUDE[000%ஸ000%z;
^
./test/errors/759573.xml:1: parser error : Content error in the external subset
./test/errors/759573.xml:1: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
T t (A)><!ENTITY % xx '&#37;<![INCLUDE[000&#37;&#3000;000&#37;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 '&#37;<![INCLUDE[000&#37;&#3000;000&#37;z;'><!ENTITYz>%xx;
^
./test/errors/759573.xml:1: parser error : DOCTYPE improperly terminated
T t (A)><!ENTITY % xx '&#37;<![INCLUDE[000&#37;&#3000;000&#37;z;'><!ENTITYz>%xx;
^
./test/errors/759573.xml:1: parser error : Start tag expected, '<' not found
T t (A)><!ENTITY % xx '&#37;<![INCLUDE[000&#37;&#3000;000&#37;z;'><!ENTITYz>%xx;
^
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment