mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-26 00:37:43 +03:00
an XML-1.0 document can't load an 1.1 entity when using entities make sure
* parser.c include/libxml/xmlerror.h: an XML-1.0 document can't load an 1.1 entity * runxmlconf.c: when using entities make sure we load them Daniel svn path=/trunk/; revision=3759
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
Wed Jul 30 14:33:33 CEST 2008 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
|
* parser.c include/libxml/xmlerror.h: an XML-1.0 document can't load
|
||||||
|
an 1.1 entity
|
||||||
|
* runxmlconf.c: when using entities make sure we load them
|
||||||
|
|
||||||
Tue Jul 29 18:43:07 CEST 2008 Daniel Veillard <daniel@veillard.com>
|
Tue Jul 29 18:43:07 CEST 2008 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
* parser.c: fix a bug not detecting cross entity comments probably
|
* parser.c: fix a bug not detecting cross entity comments probably
|
||||||
|
|||||||
@@ -204,6 +204,7 @@ typedef enum {
|
|||||||
XML_WAR_NS_COLUMN, /* 106 */
|
XML_WAR_NS_COLUMN, /* 106 */
|
||||||
XML_WAR_ENTITY_REDEFINED, /* 107 */
|
XML_WAR_ENTITY_REDEFINED, /* 107 */
|
||||||
XML_ERR_UNKNOWN_VERSION, /* 108 */
|
XML_ERR_UNKNOWN_VERSION, /* 108 */
|
||||||
|
XML_ERR_VERSION_MISMATCH, /* 109 */
|
||||||
XML_NS_ERR_XML_NAMESPACE = 200,
|
XML_NS_ERR_XML_NAMESPACE = 200,
|
||||||
XML_NS_ERR_UNDEFINED_NAMESPACE, /* 201 */
|
XML_NS_ERR_UNDEFINED_NAMESPACE, /* 201 */
|
||||||
XML_NS_ERR_QNAME, /* 202 */
|
XML_NS_ERR_QNAME, /* 202 */
|
||||||
|
|||||||
24
parser.c
24
parser.c
@@ -6204,12 +6204,10 @@ xmlParseMarkupDecl(xmlParserCtxtPtr ctxt) {
|
|||||||
/**
|
/**
|
||||||
* xmlParseTextDecl:
|
* xmlParseTextDecl:
|
||||||
* @ctxt: an XML parser context
|
* @ctxt: an XML parser context
|
||||||
*
|
*
|
||||||
* parse an XML declaration header for external entities
|
* parse an XML declaration header for external entities
|
||||||
*
|
*
|
||||||
* [77] TextDecl ::= '<?xml' VersionInfo? EncodingDecl S? '?>'
|
* [77] TextDecl ::= '<?xml' VersionInfo? EncodingDecl S? '?>'
|
||||||
*
|
|
||||||
* Question: Seems that EncodingDecl is mandatory ? Is that a typo ?
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -11671,10 +11669,10 @@ xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx, const xmlChar *URL,
|
|||||||
if (ctxt == NULL) {
|
if (ctxt == NULL) {
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ctxt->userData = ctxt;
|
ctxt->userData = ctxt;
|
||||||
ctxt->_private = ctx->_private;
|
ctxt->_private = ctx->_private;
|
||||||
|
|
||||||
inputStream = xmlLoadExternalEntity((char *)URL, (char *)ID, ctxt);
|
inputStream = xmlLoadExternalEntity((char *)URL, (char *)ID, ctxt);
|
||||||
if (inputStream == NULL) {
|
if (inputStream == NULL) {
|
||||||
xmlFreeParserCtxt(ctxt);
|
xmlFreeParserCtxt(ctxt);
|
||||||
@@ -11687,7 +11685,7 @@ xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx, const xmlChar *URL,
|
|||||||
directory = xmlParserGetDirectory((char *)URL);
|
directory = xmlParserGetDirectory((char *)URL);
|
||||||
if ((ctxt->directory == NULL) && (directory != NULL))
|
if ((ctxt->directory == NULL) && (directory != NULL))
|
||||||
ctxt->directory = directory;
|
ctxt->directory = directory;
|
||||||
|
|
||||||
oldsax = ctxt->sax;
|
oldsax = ctxt->sax;
|
||||||
ctxt->sax = ctx->sax;
|
ctxt->sax = ctx->sax;
|
||||||
xmlDetectSAX2(ctxt);
|
xmlDetectSAX2(ctxt);
|
||||||
@@ -11725,7 +11723,7 @@ xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx, const xmlChar *URL,
|
|||||||
newDoc->children->doc = ctx->myDoc;
|
newDoc->children->doc = ctx->myDoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the 4 first bytes and decode the charset
|
* Get the 4 first bytes and decode the charset
|
||||||
* if enc != XML_CHAR_ENCODING_NONE
|
* if enc != XML_CHAR_ENCODING_NONE
|
||||||
* plug some encoding conversion routines.
|
* plug some encoding conversion routines.
|
||||||
@@ -11747,6 +11745,14 @@ xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx, const xmlChar *URL,
|
|||||||
*/
|
*/
|
||||||
if ((CMP5(CUR_PTR, '<', '?', 'x', 'm', 'l')) && (IS_BLANK_CH(NXT(5)))) {
|
if ((CMP5(CUR_PTR, '<', '?', 'x', 'm', 'l')) && (IS_BLANK_CH(NXT(5)))) {
|
||||||
xmlParseTextDecl(ctxt);
|
xmlParseTextDecl(ctxt);
|
||||||
|
/*
|
||||||
|
* An XML-1.0 document can't reference an entity not XML-1.0
|
||||||
|
*/
|
||||||
|
if ((xmlStrEqual(ctx->version, BAD_CAST "1.0")) &&
|
||||||
|
(!xmlStrEqual(ctxt->input->version, BAD_CAST "1.0"))) {
|
||||||
|
xmlFatalErrMsg(ctxt, XML_ERR_VERSION_MISMATCH,
|
||||||
|
"Version mismatch between document and entity\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -11780,7 +11786,7 @@ xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx, const xmlChar *URL,
|
|||||||
ctxt->linenumbers = ctx->linenumbers;
|
ctxt->linenumbers = ctx->linenumbers;
|
||||||
|
|
||||||
xmlParseContent(ctxt);
|
xmlParseContent(ctxt);
|
||||||
|
|
||||||
ctx->validate = ctxt->validate;
|
ctx->validate = ctxt->validate;
|
||||||
ctx->valid = ctxt->valid;
|
ctx->valid = ctxt->valid;
|
||||||
if ((RAW == '<') && (NXT(1) == '/')) {
|
if ((RAW == '<') && (NXT(1) == '/')) {
|
||||||
@@ -11823,7 +11829,7 @@ xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx, const xmlChar *URL,
|
|||||||
newDoc->intSubset = NULL;
|
newDoc->intSubset = NULL;
|
||||||
newDoc->extSubset = NULL;
|
newDoc->extSubset = NULL;
|
||||||
xmlFreeDoc(newDoc);
|
xmlFreeDoc(newDoc);
|
||||||
|
|
||||||
return(ret);
|
return(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -322,6 +322,7 @@ xmlconfTestItem(xmlDocPtr doc, xmlNodePtr cur) {
|
|||||||
entities = xmlGetProp(cur, BAD_CAST "ENTITIES");
|
entities = xmlGetProp(cur, BAD_CAST "ENTITIES");
|
||||||
if (!xmlStrEqual(entities, BAD_CAST "none")) {
|
if (!xmlStrEqual(entities, BAD_CAST "none")) {
|
||||||
options |= XML_PARSE_DTDLOAD;
|
options |= XML_PARSE_DTDLOAD;
|
||||||
|
options |= XML_PARSE_NOENT;
|
||||||
}
|
}
|
||||||
rec = xmlGetProp(cur, BAD_CAST "RECOMMENDATION");
|
rec = xmlGetProp(cur, BAD_CAST "RECOMMENDATION");
|
||||||
if ((rec == NULL) ||
|
if ((rec == NULL) ||
|
||||||
|
|||||||
Reference in New Issue
Block a user