mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-27 12:15:34 +03:00
parser: Fix base URI of internal parameter entities
Search parent inputs of internal parameter entities for base URI.
Fixes a long-standing bug, which manifested in a different way after
commit 955c177f. Reproduce with
xmllint --noent xmlconf/eduni/errata-2e/E18.xml
This commit is contained in:
9
SAX2.c
9
SAX2.c
@@ -559,9 +559,14 @@ xmlSAX2EntityDecl(void *ctx, const xmlChar *name, int type,
|
|||||||
if ((ent->URI == NULL) && (systemId != NULL)) {
|
if ((ent->URI == NULL) && (systemId != NULL)) {
|
||||||
xmlChar *URI;
|
xmlChar *URI;
|
||||||
const char *base = NULL;
|
const char *base = NULL;
|
||||||
|
int i;
|
||||||
|
|
||||||
if (ctxt->input != NULL)
|
for (i = ctxt->inputNr - 1; i >= 0; i--) {
|
||||||
base = ctxt->input->filename;
|
if (ctxt->inputTab[i]->filename != NULL) {
|
||||||
|
base = ctxt->inputTab[i]->filename;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (xmlBuildURISafe(systemId, (const xmlChar *) base, &URI) < 0) {
|
if (xmlBuildURISafe(systemId, (const xmlChar *) base, &URI) < 0) {
|
||||||
xmlSAX2ErrMemory(ctxt);
|
xmlSAX2ErrMemory(ctxt);
|
||||||
|
|||||||
Reference in New Issue
Block a user