b8876f
From bb78386f13c18a1a7dae932b9b36e977056b13c7 Mon Sep 17 00:00:00 2001
b8876f
From: Yves Orton <demerphq@gmail.com>
b8876f
Date: Fri, 27 Jan 2017 16:57:40 +0100
b8876f
Subject: [PATCH] only mess with NEXT_OFF() when we are in PASS2
b8876f
MIME-Version: 1.0
b8876f
Content-Type: text/plain; charset=UTF-8
b8876f
Content-Transfer-Encoding: 8bit
b8876f
b8876f
In 31fc93954d1f379c7a49889d91436ce99818e1f6 I added code that would modify
b8876f
NEXT_OFF() when we were not in PASS2, when we should not do so. Strangly this
b8876f
did not segfault when I tested, but this fix is required.
b8876f
b8876f
Signed-off-by: Petr Písař <ppisar@redhat.com>
b8876f
---
b8876f
 regcomp.c | 4 ++--
b8876f
 1 file changed, 2 insertions(+), 2 deletions(-)
b8876f
b8876f
diff --git a/regcomp.c b/regcomp.c
b8876f
index 322d230..d5ce63f 100644
b8876f
--- a/regcomp.c
b8876f
+++ b/regcomp.c
b8876f
@@ -11709,11 +11709,11 @@ S_regpiece(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth)
b8876f
 	    nextchar(pRExC_state);
b8876f
             if (max < min) {    /* If can't match, warn and optimize to fail
b8876f
                                    unconditionally */
b8876f
+                reginsert(pRExC_state, OPFAIL, orig_emit, depth+1);
b8876f
                 if (PASS2) {
b8876f
                     ckWARNreg(RExC_parse, "Quantifier {n,m} with n > m can't match");
b8876f
+                    NEXT_OFF(orig_emit)= regarglen[OPFAIL] + NODE_STEP_REGNODE;
b8876f
                 }
b8876f
-                reginsert(pRExC_state, OPFAIL, orig_emit, depth+1);
b8876f
-                NEXT_OFF(orig_emit)= regarglen[OPFAIL] + NODE_STEP_REGNODE;
b8876f
                 return ret;
b8876f
             }
b8876f
             else if (min == max && *RExC_parse == '?')
b8876f
-- 
b8876f
2.7.4
b8876f