[jruby-joni] 04/31: fix recursion

Hideki Yamane henrich at moszumanska.debian.org
Sat Feb 24 10:44:57 UTC 2018


This is an automated email from the git hooks/post-receive script.

henrich pushed a commit to branch debian/sid
in repository jruby-joni.

commit a54891227246432003219b05164956dbea70364b
Author: Marcin Mielzynski <lopx at gazeta.pl>
Date:   Mon Jan 29 21:51:08 2018 +0100

    fix recursion
---
 src/org/joni/Analyser.java     | 24 ++++++++++++++++++------
 test/org/joni/test/TestU8.java |  1 +
 2 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/src/org/joni/Analyser.java b/src/org/joni/Analyser.java
index 2db61ad..1da0c64 100644
--- a/src/org/joni/Analyser.java
+++ b/src/org/joni/Analyser.java
@@ -473,9 +473,15 @@ final class Analyser extends Parser {
                     if (en.isMinFixed()) {
                         min = en.minLength;
                     } else {
-                        min = getMinMatchLength(en.target);
-                        en.minLength = min;
-                        en.setMinFixed();
+                        if (en.isMark1()) {
+                            min = 0; /* recursive */
+                        } else {
+                            en.setMark1();
+                            min = getMinMatchLength(en.target);
+                            en.clearMark1();
+                            en.minLength = min;
+                            en.setMinFixed();
+                        }
                     }
                 } // USE_SUBEXP_CALL
                 break;
@@ -582,9 +588,15 @@ final class Analyser extends Parser {
                     if (en.isMaxFixed()) {
                         max = en.maxLength;
                     } else {
-                        max = getMaxMatchLength(en.target);
-                        en.maxLength = max;
-                        en.setMaxFixed();
+                        if (en.isMark1()) {
+                            max = MinMaxLen.INFINITE_DISTANCE;
+                        } else {
+                            en.setMark1();
+                            max = getMaxMatchLength(en.target);
+                            en.clearMark1();
+                            en.maxLength = max;
+                            en.setMaxFixed();
+                        }
                     }
                 } // USE_SUBEXP_CALL
                 break;
diff --git a/test/org/joni/test/TestU8.java b/test/org/joni/test/TestU8.java
index 6f33a2b..c5cf149 100755
--- a/test/org/joni/test/TestU8.java
+++ b/test/org/joni/test/TestU8.java
@@ -323,5 +323,6 @@ public class TestU8 extends Test {
         x2s("[^a\\x{80}]", "x", 0, 1, Option.CR_7_BIT);
         ns("[^a\\x{80}]", "a", Option.CR_7_BIT);
 
+        ns("(\\2)(\\1)", "");
     }
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/jruby-joni.git



More information about the pkg-java-commits mailing list