diff options
author | Hugo van der Sanden <hv@crypt.org> | 2016-10-05 12:56:05 +0100 |
---|---|---|
committer | Hugo van der Sanden <hv@crypt.org> | 2017-01-19 16:44:44 +0000 |
commit | 2dfc11ec3af312f4fa3eb244077c79dbb5fc2d85 (patch) | |
tree | 3bdea149690bee2963501aaafd7401d70a5c5cdb /t | |
parent | 59143e29a717d67a61b869a6c5bb49574f1ef43f (diff) | |
download | perl-2dfc11ec3af312f4fa3eb244077c79dbb5fc2d85.tar.gz |
[perl #129377] don't read past start of string for unmatched backref
We can have (start, end) == (0, -1) for an unmatched backref, we must
check for that.
Diffstat (limited to 't')
-rw-r--r-- | t/re/pat.t | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/t/re/pat.t b/t/re/pat.t index d8315c4276..d5e5d2fd4a 100644 --- a/t/re/pat.t +++ b/t/re/pat.t @@ -23,7 +23,7 @@ BEGIN { skip_all('no re module') unless defined &DynaLoader::boot_DynaLoader; skip_all_without_unicode_tables(); -plan tests => 834; # Update this when adding/deleting tests. +plan tests => 835; # Update this when adding/deleting tests. run_tests() unless caller; @@ -1887,6 +1887,20 @@ EOF_CODE is($target =~ $re, $result, "[perl #130522] with target '$disp'"); } } + { + # [perl #129377] backref to an unmatched capture should not cause + # reading before start of string. + SKIP: { + skip "no re-debug under miniperl" if is_miniperl; + my $prog = <<'EOP'; +use re qw(Debug EXECUTE); +"x" =~ m{ () y | () \1 }x; +EOP + fresh_perl_like($prog, qr{ + \A (?! .* ^ \s+ - ) + }msx, { stderr => 1 }, "Offsets in debug output are not negative"); + } + } } # End of sub run_tests 1; |