partly import changes from tenfourfox: #651: M1761233 M1687303 M1633019 M1797336 M1799748 M1801102 (fb91afbb4)

This commit is contained in:
roytam1 2023-04-24 11:39:08 +08:00
commit ba3e46b173
4 changed files with 38 additions and 8 deletions

View file

@ -792,6 +792,14 @@ parserCreate(const XML_Char *encodingName,
parserInit(parser, encodingName);
if (encodingName && !protocolEncodingName) {
if (dtd) {
// We need to stop the upcoming call to XML_ParserFree from happily
// destroying parser->m_dtd because the DTD is shared with the parent
// parser and the only guard that keeps XML_ParserFree from destroying
// parser->m_dtd is parser->m_isParamEntity but it will be set to
// XML_TRUE only later in XML_ExternalEntityParserCreate (or not at all).
parser->m_dtd = NULL;
}
XML_ParserFree(parser);
return NULL;
}