diff options
author | Nick Wellnhofer <wellnhofer@aevum.de> | 2024-05-03 00:44:42 +0200 |
---|---|---|
committer | Nick Wellnhofer <wellnhofer@aevum.de> | 2024-05-03 11:53:45 +0200 |
commit | 71a7a33e18fce3822405be2c4ce40d03064d48ea (patch) | |
tree | 5d2f89bf79bbd1636f7ccdc933637687509cef84 | |
parent | fdc5ff36571ec7b19b991d5ed4126369095c1cb8 (diff) | |
download | libxml2-upstream-master.tar.gz |
parser: Fix base URI of internal parameter entitiesupstream-master
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
-rw-r--r-- | SAX2.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -559,9 +559,14 @@ xmlSAX2EntityDecl(void *ctx, const xmlChar *name, int type, if ((ent->URI == NULL) && (systemId != NULL)) { xmlChar *URI; const char *base = NULL; + int i; - if (ctxt->input != NULL) - base = ctxt->input->filename; + for (i = ctxt->inputNr - 1; i >= 0; i--) { + if (ctxt->inputTab[i]->filename != NULL) { + base = ctxt->inputTab[i]->filename; + break; + } + } if (xmlBuildURISafe(systemId, (const xmlChar *) base, &URI) < 0) { xmlSAX2ErrMemory(ctxt); |