Re: [ID 20000716.007] \G in a m//g expression causes problems
Hugo van der Sanden [Mon, 21 May 2001 16:32:02 +0000 (17:32 +0100)]
Message-Id: <200105211532.QAA03999@crypt.compulink.co.uk>

p4raw-id: //depot/perl@10187

regcomp.c
t/op/misc.t

index 1fdc44a..fbda209 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -1059,7 +1059,7 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp, I32 *deltap, reg
                if (!scan)              /* It was not CURLYX, but CURLY. */
                    scan = next;
                if (ckWARN(WARN_REGEXP) && (minnext + deltanext == 0)
-                   && !(data->flags & (SF_HAS_PAR|SF_IN_PAR))
+                   && data && !(data->flags & (SF_HAS_PAR|SF_IN_PAR))
                    && maxcount <= REG_INFTY/3) /* Complement check for big count */
                {
                    vWARN(RExC_parse,
index 885fad4..c791f15 100755 (executable)
@@ -661,6 +661,11 @@ new_pmop "abcdef"; reset;
 close STDERR; die;
 EXPECT
 ########
+-w
+"x" =~ /(\G?x)?/;      # core dump in 20000716.007
+EXPECT
+Quantifier unexpected on zero-length expression in regex; marked by <-- HERE in m/(\G?x)? <-- HERE / at - line 2.
+########
 # Bug 20010515.004
 my @h = 1 .. 10;
 bad(@h);