mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-30 22:43:14 +03:00
Avoid a potential infinite recursion
Which can happen when eliminating epsilon transitions, as reported by Pavel Madr <pmadr@opentext.com>
This commit is contained in:
@ -222,6 +222,7 @@ struct _xmlRegTrans {
|
|||||||
struct _xmlAutomataState {
|
struct _xmlAutomataState {
|
||||||
xmlRegStateType type;
|
xmlRegStateType type;
|
||||||
xmlRegMarkedType mark;
|
xmlRegMarkedType mark;
|
||||||
|
xmlRegMarkedType markd;
|
||||||
xmlRegMarkedType reached;
|
xmlRegMarkedType reached;
|
||||||
int no;
|
int no;
|
||||||
int maxTrans;
|
int maxTrans;
|
||||||
@ -2589,6 +2590,8 @@ xmlFARecurseDeterminism(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr state,
|
|||||||
|
|
||||||
if (state == NULL)
|
if (state == NULL)
|
||||||
return(ret);
|
return(ret);
|
||||||
|
if (state->markd == XML_REGEXP_MARK_VISITED)
|
||||||
|
return(ret);
|
||||||
|
|
||||||
if (ctxt->flags & AM_AUTOMATA_RNG)
|
if (ctxt->flags & AM_AUTOMATA_RNG)
|
||||||
deep = 0;
|
deep = 0;
|
||||||
@ -2606,8 +2609,10 @@ xmlFARecurseDeterminism(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr state,
|
|||||||
if (t1->atom == NULL) {
|
if (t1->atom == NULL) {
|
||||||
if (t1->to < 0)
|
if (t1->to < 0)
|
||||||
continue;
|
continue;
|
||||||
|
state->markd = XML_REGEXP_MARK_VISITED;
|
||||||
res = xmlFARecurseDeterminism(ctxt, ctxt->states[t1->to],
|
res = xmlFARecurseDeterminism(ctxt, ctxt->states[t1->to],
|
||||||
to, atom);
|
to, atom);
|
||||||
|
state->markd = 0;
|
||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
ret = 0;
|
ret = 0;
|
||||||
/* t1->nd = 1; */
|
/* t1->nd = 1; */
|
||||||
|
Reference in New Issue
Block a user