1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-10-24 13:33:01 +03:00

html: Avoid HTML_PARSE_HTML5 clashing with XML_PARSE_NOENT

There are several users that pass invalid XML parser options to the
HTML parser. Choose a value that is less likely to clash.
This commit is contained in:
Nick Wellnhofer
2025-04-18 17:28:24 +02:00
parent 6896f478d4
commit 4ba1f9238a
2 changed files with 6 additions and 3 deletions

View File

@@ -5768,7 +5768,10 @@ htmlCtxtSetOptionsInternal(xmlParserCtxtPtr ctxt, int options, int keepMask)
ctxt->linenumbers = 1; ctxt->linenumbers = 1;
return(options & ~allMask); /*
* Allow XML_PARSE_NOENT which many users set on the HTML parser.
*/
return(options & ~allMask & ~XML_PARSE_NOENT);
} }
/** /**

View File

@@ -203,7 +203,6 @@ XMLPUBFUN void
*/ */
typedef enum { typedef enum {
HTML_PARSE_RECOVER = 1<<0, /* No effect */ HTML_PARSE_RECOVER = 1<<0, /* No effect */
HTML_PARSE_HTML5 = 1<<1, /* HTML5 support */
HTML_PARSE_NODEFDTD = 1<<2, /* do not default a doctype if not found */ HTML_PARSE_NODEFDTD = 1<<2, /* do not default a doctype if not found */
HTML_PARSE_NOERROR = 1<<5, /* suppress error reports */ HTML_PARSE_NOERROR = 1<<5, /* suppress error reports */
HTML_PARSE_NOWARNING= 1<<6, /* suppress warning reports */ HTML_PARSE_NOWARNING= 1<<6, /* suppress warning reports */
@@ -214,7 +213,8 @@ typedef enum {
HTML_PARSE_COMPACT = 1<<16,/* compact small text nodes */ HTML_PARSE_COMPACT = 1<<16,/* compact small text nodes */
HTML_PARSE_HUGE = 1<<19,/* relax any hardcoded limit from the parser */ HTML_PARSE_HUGE = 1<<19,/* relax any hardcoded limit from the parser */
HTML_PARSE_IGNORE_ENC=1<<21,/* ignore internal document encoding hint */ HTML_PARSE_IGNORE_ENC=1<<21,/* ignore internal document encoding hint */
HTML_PARSE_BIG_LINES= 1<<22 /* Store big lines numbers in text PSVI field */ HTML_PARSE_BIG_LINES= 1<<22,/* Store big lines numbers in text PSVI field */
HTML_PARSE_HTML5 = 1<<26 /* HTML5 support */
} htmlParserOption; } htmlParserOption;
XMLPUBFUN void XMLPUBFUN void