mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-03-10 08:58:16 +03:00
rework the patch to avoid some ABI issue with people allocating entities
* include/libxml/entities.h entities.c SAX2.c parser.c: rework the patch to avoid some ABI issue with people allocating entities structure directly Daniel svn path=/trunk/; revision=3773
This commit is contained in:
parent
4bf899bf1b
commit
f4f4e4853a
@ -1,3 +1,9 @@
|
||||
Mon Aug 25 10:56:30 CEST 2008 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* include/libxml/entities.h entities.c SAX2.c parser.c: rework
|
||||
the patch to avoid some ABI issue with people allocating
|
||||
entities structure directly
|
||||
|
||||
Wed Aug 20 19:02:01 CEST 2008 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* include/libxml/parser.h include/libxml/entities.h entities.c
|
||||
|
3
SAX2.c
3
SAX2.c
@ -580,7 +580,8 @@ xmlSAX2GetEntity(void *ctx, const xmlChar *name)
|
||||
return(NULL);
|
||||
}
|
||||
ret->owner = 1;
|
||||
ret->checked = 1;
|
||||
if (ret->checked == 0)
|
||||
ret->checked = 1;
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
10
entities.c
10
entities.c
@ -31,35 +31,35 @@ static xmlEntity xmlEntityLt = {
|
||||
NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
BAD_CAST "<", BAD_CAST "<", 1,
|
||||
XML_INTERNAL_PREDEFINED_ENTITY,
|
||||
NULL, NULL, NULL, NULL, 0, 1, 0
|
||||
NULL, NULL, NULL, NULL, 0, 1
|
||||
};
|
||||
static xmlEntity xmlEntityGt = {
|
||||
NULL, XML_ENTITY_DECL, BAD_CAST "gt",
|
||||
NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
BAD_CAST ">", BAD_CAST ">", 1,
|
||||
XML_INTERNAL_PREDEFINED_ENTITY,
|
||||
NULL, NULL, NULL, NULL, 0, 1, 0
|
||||
NULL, NULL, NULL, NULL, 0, 1
|
||||
};
|
||||
static xmlEntity xmlEntityAmp = {
|
||||
NULL, XML_ENTITY_DECL, BAD_CAST "amp",
|
||||
NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
BAD_CAST "&", BAD_CAST "&", 1,
|
||||
XML_INTERNAL_PREDEFINED_ENTITY,
|
||||
NULL, NULL, NULL, NULL, 0, 1, 0
|
||||
NULL, NULL, NULL, NULL, 0, 1
|
||||
};
|
||||
static xmlEntity xmlEntityQuot = {
|
||||
NULL, XML_ENTITY_DECL, BAD_CAST "quot",
|
||||
NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
BAD_CAST "\"", BAD_CAST "\"", 1,
|
||||
XML_INTERNAL_PREDEFINED_ENTITY,
|
||||
NULL, NULL, NULL, NULL, 0, 1, 0
|
||||
NULL, NULL, NULL, NULL, 0, 1
|
||||
};
|
||||
static xmlEntity xmlEntityApos = {
|
||||
NULL, XML_ENTITY_DECL, BAD_CAST "apos",
|
||||
NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
BAD_CAST "'", BAD_CAST "'", 1,
|
||||
XML_INTERNAL_PREDEFINED_ENTITY,
|
||||
NULL, NULL, NULL, NULL, 0, 1, 0
|
||||
NULL, NULL, NULL, NULL, 0, 1
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -57,7 +57,6 @@ struct _xmlEntity {
|
||||
const xmlChar *URI; /* the full URI as computed */
|
||||
int owner; /* does the entity own the childrens */
|
||||
int checked; /* was the entity content checked */
|
||||
unsigned long nbentities; /* the number of entities references */
|
||||
};
|
||||
|
||||
/*
|
||||
|
17
parser.c
17
parser.c
@ -2421,7 +2421,7 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len,
|
||||
goto int_error;
|
||||
ctxt->nbentities++;
|
||||
if (ent != NULL)
|
||||
ctxt->nbentities += ent->nbentities;
|
||||
ctxt->nbentities += ent->checked;
|
||||
if ((ent != NULL) &&
|
||||
(ent->etype == XML_INTERNAL_PREDEFINED_ENTITY)) {
|
||||
if (ent->content != NULL) {
|
||||
@ -2471,7 +2471,7 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len,
|
||||
goto int_error;
|
||||
ctxt->nbentities++;
|
||||
if (ent != NULL)
|
||||
ctxt->nbentities += ent->nbentities;
|
||||
ctxt->nbentities += ent->checked;
|
||||
if (ent != NULL) {
|
||||
if (ent->content == NULL) {
|
||||
if (xmlLoadEntityContent(ctxt, ent) < 0) {
|
||||
@ -3555,7 +3555,7 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) {
|
||||
ent = xmlParseEntityRef(ctxt);
|
||||
ctxt->nbentities++;
|
||||
if (ent != NULL)
|
||||
ctxt->nbentities += ent->nbentities;
|
||||
ctxt->nbentities += ent->checked;
|
||||
if ((ent != NULL) &&
|
||||
(ent->etype == XML_INTERNAL_PREDEFINED_ENTITY)) {
|
||||
if (len > buf_size - 10) {
|
||||
@ -5083,7 +5083,7 @@ xmlParseEntityDecl(xmlParserCtxtPtr ctxt) {
|
||||
}
|
||||
}
|
||||
if (cur != NULL) {
|
||||
cur->nbentities = ctxt->nbentities - oldnbent;
|
||||
cur->checked = ctxt->nbentities - oldnbent;
|
||||
if (cur->orig != NULL)
|
||||
xmlFree(orig);
|
||||
else
|
||||
@ -6594,7 +6594,7 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
|
||||
xmlErrMsgStr(ctxt, XML_ERR_INTERNAL_ERROR,
|
||||
"invalid entity type found\n", NULL);
|
||||
}
|
||||
ent->nbentities = ctxt->nbentities - oldnbent;
|
||||
ent->checked = ctxt->nbentities - oldnbent;
|
||||
if (ret == XML_ERR_ENTITY_LOOP) {
|
||||
xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL);
|
||||
return;
|
||||
@ -6651,9 +6651,10 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
|
||||
list = NULL;
|
||||
}
|
||||
}
|
||||
ent->checked = 1;
|
||||
if (ent->checked == 0)
|
||||
ent->checked = 1;
|
||||
}
|
||||
ctxt->nbentities += ent->nbentities;
|
||||
ctxt->nbentities += ent->checked;
|
||||
|
||||
if (ent->children == NULL) {
|
||||
/*
|
||||
@ -6662,7 +6663,7 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
|
||||
* though parsing for first checking go though the entity
|
||||
* content to generate callbacks associated to the entity
|
||||
*/
|
||||
if (was_checked == 1) {
|
||||
if (was_checked != 0) {
|
||||
void *user_data;
|
||||
/*
|
||||
* This is a bit hackish but this seems the best
|
||||
|
Loading…
x
Reference in New Issue
Block a user