mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-30 22:43:14 +03:00
first part of fixing #78729 Daniel
* valid.c: first part of fixing #78729 Daniel
This commit is contained in:
@ -1,3 +1,7 @@
|
|||||||
|
Mon Apr 15 12:14:49 CEST 2002 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
|
* valid.c: first part of fixing #78729
|
||||||
|
|
||||||
Sun Apr 14 23:44:58 CEST 2002 Daniel Veillard <daniel@veillard.com>
|
Sun Apr 14 23:44:58 CEST 2002 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
* HTMLtree.c uri.c: fixing bug #78662 i.e. add proper
|
* HTMLtree.c uri.c: fixing bug #78662 i.e. add proper
|
||||||
|
15
valid.c
15
valid.c
@ -91,6 +91,7 @@ typedef struct _xmlValidState {
|
|||||||
unsigned char state; /* ROLLBACK_XXX */
|
unsigned char state; /* ROLLBACK_XXX */
|
||||||
} _xmlValidState;
|
} _xmlValidState;
|
||||||
|
|
||||||
|
#define MAX_RECURSE 1024
|
||||||
#define MAX_DEPTH ((sizeof(_xmlValidState.occurs)) * 8)
|
#define MAX_DEPTH ((sizeof(_xmlValidState.occurs)) * 8)
|
||||||
#define CONT ctxt->vstate->cont
|
#define CONT ctxt->vstate->cont
|
||||||
#define NODE ctxt->vstate->node
|
#define NODE ctxt->vstate->node
|
||||||
@ -110,6 +111,9 @@ vstateVPush(xmlValidCtxtPtr ctxt, xmlElementContentPtr cont,
|
|||||||
unsigned char state) {
|
unsigned char state) {
|
||||||
int i = ctxt->vstateNr - 1;
|
int i = ctxt->vstateNr - 1;
|
||||||
|
|
||||||
|
if (ctxt->vstateNr > MAX_RECURSE) {
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
if (ctxt->vstateNr >= ctxt->vstateMax) {
|
if (ctxt->vstateNr >= ctxt->vstateMax) {
|
||||||
ctxt->vstateMax *= 2;
|
ctxt->vstateMax *= 2;
|
||||||
ctxt->vstateTab = (xmlValidState *) xmlRealloc(ctxt->vstateTab,
|
ctxt->vstateTab = (xmlValidState *) xmlRealloc(ctxt->vstateTab,
|
||||||
@ -117,7 +121,7 @@ vstateVPush(xmlValidCtxtPtr ctxt, xmlElementContentPtr cont,
|
|||||||
if (ctxt->vstateTab == NULL) {
|
if (ctxt->vstateTab == NULL) {
|
||||||
xmlGenericError(xmlGenericErrorContext,
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
"realloc failed !n");
|
"realloc failed !n");
|
||||||
return(0);
|
return(-1);
|
||||||
}
|
}
|
||||||
ctxt->vstate = &ctxt->vstateTab[0];
|
ctxt->vstate = &ctxt->vstateTab[0];
|
||||||
}
|
}
|
||||||
@ -3608,7 +3612,8 @@ cont:
|
|||||||
(CONT->ocur == XML_ELEMENT_CONTENT_OPT) ||
|
(CONT->ocur == XML_ELEMENT_CONTENT_OPT) ||
|
||||||
((CONT->ocur == XML_ELEMENT_CONTENT_PLUS) && (OCCURRENCE)))) {
|
((CONT->ocur == XML_ELEMENT_CONTENT_PLUS) && (OCCURRENCE)))) {
|
||||||
DEBUG_VALID_MSG("saving parent branch");
|
DEBUG_VALID_MSG("saving parent branch");
|
||||||
vstateVPush(ctxt, CONT, NODE, DEPTH, OCCURS, ROLLBACK_PARENT);
|
if (vstateVPush(ctxt, CONT, NODE, DEPTH, OCCURS, ROLLBACK_PARENT) < 0)
|
||||||
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3714,9 +3719,9 @@ cont:
|
|||||||
* save the second branch 'or' branch
|
* save the second branch 'or' branch
|
||||||
*/
|
*/
|
||||||
DEBUG_VALID_MSG("saving 'or' branch");
|
DEBUG_VALID_MSG("saving 'or' branch");
|
||||||
vstateVPush(ctxt, CONT->c2, NODE, (unsigned char)(DEPTH + 1),
|
if (vstateVPush(ctxt, CONT->c2, NODE, (unsigned char)(DEPTH + 1),
|
||||||
OCCURS, ROLLBACK_OR);
|
OCCURS, ROLLBACK_OR) < 0)
|
||||||
|
return(-1);
|
||||||
DEPTH++;
|
DEPTH++;
|
||||||
CONT = CONT->c1;
|
CONT = CONT->c1;
|
||||||
goto cont;
|
goto cont;
|
||||||
|
Reference in New Issue
Block a user