mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-24 13:33:01 +03:00
Fix null deref in legacy SAX1 parser
Always call nameNsPush instead of namePush. The latter is unused now
and should probably be removed from the public API. I can't see how
it could be used reasonably from client code and the unprefixed name
has always polluted the global namespace.
Fixes a null pointer dereference introduced with de5b624f when parsing
in SAX1 mode.
Found by OSS-Fuzz.
This commit is contained in:
15
parser.c
15
parser.c
@@ -10025,12 +10025,7 @@ xmlParseElementStart(xmlParserCtxtPtr ctxt) {
|
||||
spacePop(ctxt);
|
||||
return(-1);
|
||||
}
|
||||
if (ctxt->sax2)
|
||||
nameNsPush(ctxt, name, prefix, URI, line, ctxt->nsNr - nsNr);
|
||||
#ifdef LIBXML_SAX1_ENABLED
|
||||
else
|
||||
namePush(ctxt, name);
|
||||
#endif /* LIBXML_SAX1_ENABLED */
|
||||
nameNsPush(ctxt, name, prefix, URI, line, ctxt->nsNr - nsNr);
|
||||
ret = ctxt->node;
|
||||
|
||||
#ifdef LIBXML_VALID_ENABLED
|
||||
@@ -11496,13 +11491,7 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
|
||||
nodePop(ctxt);
|
||||
spacePop(ctxt);
|
||||
}
|
||||
if (ctxt->sax2)
|
||||
nameNsPush(ctxt, name, prefix, URI, line,
|
||||
ctxt->nsNr - nsNr);
|
||||
#ifdef LIBXML_SAX1_ENABLED
|
||||
else
|
||||
namePush(ctxt, name);
|
||||
#endif /* LIBXML_SAX1_ENABLED */
|
||||
nameNsPush(ctxt, name, prefix, URI, line, ctxt->nsNr - nsNr);
|
||||
|
||||
ctxt->instate = XML_PARSER_CONTENT;
|
||||
ctxt->progressive = 1;
|
||||
|
||||
Reference in New Issue
Block a user