• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1From e301865e69b9b834f7b777dc58a9cee40ae056b2 Mon Sep 17 00:00:00 2001
2From: Nick Wellnhofer <wellnhofer@aevum.de>
3Date: Thu, 9 Mar 2023 05:34:38 +0100
4Subject: [PATCH] regexp: Fix checks for eliminated transitions
5
6'to' can be set to -1 or -2 when eliminating transitions, so check for
7all negative values.
8
9Reference:https://github.com/GNOME/libxml2/commit/e301865e69b9b834f7b777dc58a9cee40ae056b2
10Conflict:NA
11
12---
13 xmlregexp.c | 12 ++++++------
14 1 file changed, 6 insertions(+), 6 deletions(-)
15
16diff --git a/xmlregexp.c b/xmlregexp.c
17index 24f9fc0..df0626c 100644
18--- a/xmlregexp.c
19+++ b/xmlregexp.c
20@@ -607,7 +607,7 @@ xmlRegEpxFromParse(xmlRegParserCtxtPtr ctxt) {
21
22 	    for (j = 0;j < state->nbTrans;j++) {
23 		trans = &(state->trans[j]);
24-		if ((trans->to == -1) || (trans->atom == NULL))
25+		if ((trans->to < 0) || (trans->atom == NULL))
26 		    continue;
27                 atomno = stringRemap[trans->atom->no];
28 		if ((trans->atom->data != NULL) && (transdata == NULL)) {
29@@ -2783,11 +2783,11 @@ xmlFAComputesDeterminism(xmlRegParserCtxtPtr ctxt) {
30 		/* t1->nd = 1; */
31 		continue;
32 	    }
33-	    if (t1->to == -1) /* eliminated */
34+	    if (t1->to < 0) /* eliminated */
35 		continue;
36 	    for (i = 0;i < transnr;i++) {
37 		t2 = &(state->trans[i]);
38-		if (t2->to == -1) /* eliminated */
39+		if (t2->to < 0) /* eliminated */
40 		    continue;
41 		if (t2->atom != NULL) {
42 		    if (t1->to == t2->to) {
43@@ -2825,11 +2825,11 @@ xmlFAComputesDeterminism(xmlRegParserCtxtPtr ctxt) {
44 	    if (t1->atom == NULL) {
45 		continue;
46 	    }
47-	    if (t1->to == -1) /* eliminated */
48+	    if (t1->to < 0) /* eliminated */
49 		continue;
50 	    for (i = 0;i < transnr;i++) {
51 		t2 = &(state->trans[i]);
52-		if (t2->to == -1) /* eliminated */
53+		if (t2->to < 0) /* eliminated */
54 		    continue;
55 		if (t2->atom != NULL) {
56                     /*
57@@ -2843,7 +2843,7 @@ xmlFAComputesDeterminism(xmlRegParserCtxtPtr ctxt) {
58 			t2->nd = 1;
59 			last = t1;
60 		    }
61-		} else if (t1->to != -1) {
62+		} else {
63 		    /*
64 		     * do the closure in case of remaining specific
65 		     * epsilon transitions like choices or all
66--
672.27.0
68
69