1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-03-27 18:50:07 +03:00

parser: Make catalog PIs opt-in

This is an obscure feature that shouldn't be enabled by default.
This commit is contained in:
Nick Wellnhofer 2025-01-29 00:17:01 +01:00
parent 1082d813e8
commit 93506d41cb
4 changed files with 8 additions and 8 deletions

2
NEWS
View File

@ -16,7 +16,7 @@ existing parser context was added.
The xmlSave API now has additional options to replace global settings.
Parser options XML_PARSE_UNZIP, XML_PARSE_NO_SYS_CATALOG and
XML_PARSE_NO_CATALOG_PI were added.
XML_PARSE_CATALOG_PI were added.
The serialization API will now take user-provided or default encodings
into account when serializing attribute values, matching the

View File

@ -3420,7 +3420,7 @@ xmlCatalogConvert(void) {
* xmlCatalogGetDefaults:
*
* DEPRECATED: Use XML_PARSE_NO_SYS_CATALOG and
* XML_PARSE_NO_CATALOG_PI.
* XML_PARSE_CATALOG_PI.
*
* Used to get the user preference w.r.t. to what catalogs should
* be accepted
@ -3437,7 +3437,7 @@ xmlCatalogGetDefaults(void) {
* @allow: what catalogs should be accepted
*
* DEPRECATED: Use XML_PARSE_NO_SYS_CATALOG and
* XML_PARSE_NO_CATALOG_PI.
* XML_PARSE_CATALOG_PI.
*
* Used to set the user preference w.r.t. to what catalogs should
* be accepted

View File

@ -1419,7 +1419,7 @@ typedef enum {
/* since 2.14.0 */
XML_PARSE_UNZIP = 1<<24,/* allow compressed content */
XML_PARSE_NO_SYS_CATALOG = 1<<25,/* disable global system catalog */
XML_PARSE_NO_CATALOG_PI = 1<<26 /* ignore catalog PIs */
XML_PARSE_CATALOG_PI = 1<<26 /* allow catalog PIs */
} xmlParserOption;
XMLPUBFUN void

View File

@ -5676,7 +5676,7 @@ xmlParsePI(xmlParserCtxtPtr ctxt) {
(xmlStrEqual(target, XML_CATALOG_PI))) {
xmlCatalogAllow allow = xmlCatalogGetDefaults();
if (((ctxt->options & XML_PARSE_NO_CATALOG_PI) == 0) &&
if ((ctxt->options & XML_PARSE_CATALOG_PI) &&
((allow == XML_CATA_ALLOW_DOCUMENT) ||
(allow == XML_CATA_ALLOW_ALL)))
xmlParseCatalogPI(ctxt, buf);
@ -13580,7 +13580,7 @@ xmlCtxtSetOptionsInternal(xmlParserCtxtPtr ctxt, int options, int keepMask)
XML_PARSE_NO_XXE |
XML_PARSE_UNZIP |
XML_PARSE_NO_SYS_CATALOG |
XML_PARSE_NO_CATALOG_PI;
XML_PARSE_CATALOG_PI;
ctxt->options = (ctxt->options & keepMask) | (options & allMask);
@ -13788,9 +13788,9 @@ xmlCtxtSetOptionsInternal(xmlParserCtxtPtr ctxt, int options, int keepMask)
*
* Available since 2.14.0.
*
* XML_PARSE_NO_CATALOG_PI
* XML_PARSE_CATALOG_PI
*
* Ignore XML catalog processing instructions.
* Enable XML catalog processing instructions.
*
* Available since 2.14.0.
*