summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Wellnhofer <wellnhofer@aevum.de>2023-03-09 05:34:38 +0100
committerNick Wellnhofer <wellnhofer@aevum.de>2023-04-30 22:36:51 +0200
commite301865e69b9b834f7b777dc58a9cee40ae056b2 (patch)
treeb5387637f74ab9d478aa83371151d6a2f1cf407c
parent90759c598da91ae14258d57c251dd835267f46be (diff)
downloadlibxml2-e301865e69b9b834f7b777dc58a9cee40ae056b2.tar.gz
regexp: Fix checks for eliminated transitions
'to' can be set to -1 or -2 when eliminating transitions, so check for all negative values.
-rw-r--r--xmlregexp.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/xmlregexp.c b/xmlregexp.c
index 353d879b..657e615a 100644
--- a/xmlregexp.c
+++ b/xmlregexp.c
@@ -600,7 +600,7 @@ xmlRegEpxFromParse(xmlRegParserCtxtPtr ctxt) {
for (j = 0;j < state->nbTrans;j++) {
trans = &(state->trans[j]);
- if ((trans->to == -1) || (trans->atom == NULL))
+ if ((trans->to < 0) || (trans->atom == NULL))
continue;
atomno = stringRemap[trans->atom->no];
if ((trans->atom->data != NULL) && (transdata == NULL)) {
@@ -2758,11 +2758,11 @@ xmlFAComputesDeterminism(xmlRegParserCtxtPtr ctxt) {
/* t1->nd = 1; */
continue;
}
- if (t1->to == -1) /* eliminated */
+ if (t1->to < 0) /* eliminated */
continue;
for (i = 0;i < transnr;i++) {
t2 = &(state->trans[i]);
- if (t2->to == -1) /* eliminated */
+ if (t2->to < 0) /* eliminated */
continue;
if (t2->atom != NULL) {
if (t1->to == t2->to) {
@@ -2800,11 +2800,11 @@ xmlFAComputesDeterminism(xmlRegParserCtxtPtr ctxt) {
if (t1->atom == NULL) {
continue;
}
- if (t1->to == -1) /* eliminated */
+ if (t1->to < 0) /* eliminated */
continue;
for (i = 0;i < transnr;i++) {
t2 = &(state->trans[i]);
- if (t2->to == -1) /* eliminated */
+ if (t2->to < 0) /* eliminated */
continue;
if (t2->atom != NULL) {
/*
@@ -2818,7 +2818,7 @@ xmlFAComputesDeterminism(xmlRegParserCtxtPtr ctxt) {
t2->nd = 1;
last = t1;
}
- } else if (t1->to != -1) {
+ } else {
/*
* do the closure in case of remaining specific
* epsilon transitions like choices or all