Test malformed XML/text declaration rejected by ext entity parser

This commit is contained in:
Rhodri James 2017-03-02 16:46:29 +00:00 committed by Sebastian Pipping
parent 1d80cc21a8
commit 2cbcf88443

View File

@ -3689,6 +3689,7 @@ external_entity_valuer(XML_Parser parser,
else if (!strcmp(systemId, "004-2.ent")) {
ExtFaults *fault = (ExtFaults *)XML_GetUserData(parser);
enum XML_Status status;
enum XML_Error error;
status = _XML_Parse_SINGLE_BYTES(ext_parser,
fault->parse_text,
@ -3700,7 +3701,10 @@ external_entity_valuer(XML_Parser parser,
} else {
if (status != XML_STATUS_ERROR)
fail(fault->fail_text);
if (XML_GetErrorCode(ext_parser) != fault->error)
error = XML_GetErrorCode(ext_parser);
if (error != fault->error &&
(fault->error != XML_ERROR_XML_DECL ||
error != XML_ERROR_TEXT_DECL))
xml_failure(ext_parser);
}
}
@ -3745,6 +3749,12 @@ START_TEST(test_external_entity_values)
NULL,
XML_ERROR_NONE
},
{
"<?xml?>",
"Malformed XML declaration not faulted",
NULL,
XML_ERROR_XML_DECL
},
{ NULL, NULL, NULL, XML_ERROR_NONE }
};
int i;