In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/56f81afc0f2d331537f38e6f12b86a850187cb8a?hp=63ccd0da9435cfcf9528ac282e84220fd9375885>
- Log ----------------------------------------------------------------- commit 56f81afc0f2d331537f38e6f12b86a850187cb8a Author: Hugo van der Sanden <[email protected]> Date: Fri Jan 16 12:11:32 2015 +0000 intuit_more: no need to copy before keyword check That also avoids crashing on overrun. ----------------------------------------------------------------------- Summary of changes: t/re/pat.t | 11 ++++++++++- toke.c | 7 +++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/t/re/pat.t b/t/re/pat.t index ec68e6b..3d52554 100644 --- a/t/re/pat.t +++ b/t/re/pat.t @@ -22,7 +22,7 @@ BEGIN { skip_all_without_unicode_tables(); } -plan tests => 757; # Update this when adding/deleting tests. +plan tests => 759; # Update this when adding/deleting tests. run_tests() unless caller; @@ -1626,6 +1626,15 @@ EOP like("TffffffffffffT\x{100}TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT5TTTTTTTTTTTTTTTTTTTTTTTTT3TTgTTTTTTTTTTTTTTTTTTTTT2TTTTTTTTTTTTTTTTTTTTTTTHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH ... [652 chars truncated] } + { # [perl #123604] + my($s, $x, @x) = ('abc', 'a', 'd'); + my $long = 'b' x 2000; + my $eval = q{$s =~ m{$x[bbb]c} ? 1 : 0}; + $eval =~ s{bbb}{$long}; + my $match = eval $eval; + ok(1, "did not crash"); + ok($match, "[bbb...] resolved as character class, not subscript"); + } } # End of sub run_tests 1; diff --git a/toke.c b/toke.c index 55d3af9..f34bbee 100644 --- a/toke.c +++ b/toke.c @@ -3827,11 +3827,10 @@ S_intuit_more(pTHX_ char *s) && !(last_un_char == '$' || last_un_char == '@' || last_un_char == '&') && isALPHA(*s) && s[1] && isALPHA(s[1])) { - char *d = tmpbuf; + char *d = s; while (isALPHA(*s)) - *d++ = *s++; - *d = '\0'; - if (keyword(tmpbuf, d - tmpbuf, 0)) + s++; + if (keyword(d, s - d, 0)) weight -= 150; } if (un_char == last_un_char + 1) -- Perl5 Master Repository
