aboutsummaryrefslogtreecommitdiffstats
path: root/xmlregexp.c
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@redhat.com>2012-08-27 12:03:40 +0800
committerDaniel Veillard <veillard@redhat.com>2012-08-27 12:03:40 +0800
commit466fcdaa33258cf3633887222146b891d202cc6c (patch)
tree349511c3a9e243a56b97b55dd904eac145f91224 /xmlregexp.c
parent3e031b7dae590bdd03084a5971d9f9e66fe5d50b (diff)
downloadandroid_external_libxml2-466fcdaa33258cf3633887222146b891d202cc6c.tar.gz
android_external_libxml2-466fcdaa33258cf3633887222146b891d202cc6c.tar.bz2
android_external_libxml2-466fcdaa33258cf3633887222146b891d202cc6c.zip
Avoid a potential infinite recursion
Which can happen when eliminating epsilon transitions, as reported by Pavel Madr <pmadr@opentext.com>
Diffstat (limited to 'xmlregexp.c')
-rw-r--r--xmlregexp.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/xmlregexp.c b/xmlregexp.c
index b9527085..493bfc7e 100644
--- a/xmlregexp.c
+++ b/xmlregexp.c
@@ -222,6 +222,7 @@ struct _xmlRegTrans {
struct _xmlAutomataState {
xmlRegStateType type;
xmlRegMarkedType mark;
+ xmlRegMarkedType markd;
xmlRegMarkedType reached;
int no;
int maxTrans;
@@ -2589,6 +2590,8 @@ xmlFARecurseDeterminism(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr state,
if (state == NULL)
return(ret);
+ if (state->markd == XML_REGEXP_MARK_VISITED)
+ return(ret);
if (ctxt->flags & AM_AUTOMATA_RNG)
deep = 0;
@@ -2606,8 +2609,10 @@ xmlFARecurseDeterminism(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr state,
if (t1->atom == NULL) {
if (t1->to < 0)
continue;
+ state->markd = XML_REGEXP_MARK_VISITED;
res = xmlFARecurseDeterminism(ctxt, ctxt->states[t1->to],
to, atom);
+ state->markd = 0;
if (res == 0) {
ret = 0;
/* t1->nd = 1; */