Make $' work past the 2**31 threshold
authorFather Chrysostomos <sprout@cpan.org>
Thu, 25 Jul 2013 23:41:01 +0000 (16:41 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 25 Aug 2013 19:23:59 +0000 (12:23 -0700)
regcomp.c
regexp.h
t/bigmem/regexp.t

index 125a9a2..5a55756 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -6728,7 +6728,7 @@ Perl_reg_numbered_buff_fetch(pTHX_ REGEXP * const r, const I32 paren,
 {
     struct regexp *const rx = ReANY(r);
     char *s = NULL;
-    I32 i = 0;
+    SSize_t i = 0;
     SSize_t s1, t1;
     I32 n = paren;
 
index c8d03e3..ebbbde1 100644 (file)
--- a/regexp.h
+++ b/regexp.h
@@ -124,7 +124,7 @@ struct reg_code_block {
        /* saved or original string so \digit works forever. */         \
        char *subbeg;                                                   \
        SV_SAVED_COPY   /* If non-NULL, SV which is COW from original */\
-       I32 sublen;     /* Length of string pointed by subbeg */        \
+       SSize_t sublen; /* Length of string pointed by subbeg */        \
        I32 suboffset;  /* byte offset of subbeg from logical start of str */ \
        I32 subcoffset; /* suboffset equiv, but in chars (for @-/@+) */ \
        /* Information about the match that isn't often used */         \
index ef74e59..da7bf26 100644 (file)
@@ -12,7 +12,7 @@ $ENV{PERL_TEST_MEMORY} >= 2
 $Config{ptrsize} >= 8
     or skip_all("Need 64-bit pointers for this test");
 
-plan(3);
+plan(4);
 
 # [perl #116907]
 # ${\2} to defeat constant folding, which in this case actually slows
@@ -28,3 +28,6 @@ for(1..5) {
     $result .= "$&-";
 }
 is $result," -a-b-c-d-", 'scalar //g hopping past the 2**31 threshold';
+pos $x = 2**31+3;
+$x =~ /./g;
+is "$'", 'efg', q "$' after match against long string";