mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-24 13:33:01 +03:00
parser: Only set input ID for PE refs
Other input streams don't require IDs.
This commit is contained in:
8
parser.c
8
parser.c
@@ -7850,12 +7850,20 @@ xmlParsePEReference(xmlParserCtxtPtr ctxt)
|
||||
return;
|
||||
}
|
||||
|
||||
if (ctxt->input_id >= INT_MAX) {
|
||||
xmlFatalErr(ctxt, XML_ERR_RESOURCE_LIMIT,
|
||||
"Input ID overflow\n");
|
||||
return;
|
||||
}
|
||||
|
||||
input = xmlNewEntityInputStream(ctxt, entity);
|
||||
if (xmlPushInput(ctxt, input) < 0) {
|
||||
xmlFreeInputStream(input);
|
||||
return;
|
||||
}
|
||||
|
||||
input->id = ++ctxt->input_id;
|
||||
|
||||
entity->flags |= XML_ENT_EXPANDING;
|
||||
|
||||
if (entity->etype == XML_EXTERNAL_PARAMETER_ENTITY) {
|
||||
|
||||
@@ -1509,19 +1509,6 @@ xmlNewInputStream(xmlParserCtxtPtr ctxt) {
|
||||
input->line = 1;
|
||||
input->col = 1;
|
||||
|
||||
/*
|
||||
* If the context is NULL the id cannot be initialized, but that
|
||||
* should not happen while parsing which is the situation where
|
||||
* the id is actually needed.
|
||||
*/
|
||||
if (ctxt != NULL) {
|
||||
if (input->id >= INT_MAX) {
|
||||
xmlCtxtErrMemory(ctxt);
|
||||
return(NULL);
|
||||
}
|
||||
input->id = ctxt->input_id++;
|
||||
}
|
||||
|
||||
return(input);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user