diff options
author | Karl Williamson <khw@cpan.org> | 2016-08-27 19:16:17 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2016-08-29 14:42:26 -0600 |
commit | 109ac342a6bc5a3a67c3b52341607100cedafdf7 (patch) | |
tree | 827108d349fe44b4cc0556f8e6946eb19f33afaa /t | |
parent | ce66b506fa280c2ede0b0d4a3e81b53d0e31cb48 (diff) | |
download | perl-109ac342a6bc5a3a67c3b52341607100cedafdf7.tar.gz |
PATCH: [perl #129038] Crash with s///l
The cause of this was bad logic. It thought it was dealing with UTF-8
when it wasn't.
Diffstat (limited to 't')
-rw-r--r-- | t/re/subst.t | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/t/re/subst.t b/t/re/subst.t index 2de1a7b7be..d32e7b8aef 100644 --- a/t/re/subst.t +++ b/t/re/subst.t @@ -11,7 +11,7 @@ BEGIN { require './loc_tools.pl'; } -plan( tests => 270 ); +plan( tests => 271 ); $_ = 'david'; $a = s/david/rules/r; @@ -1102,3 +1102,20 @@ SKIP: { $s =~ s/..\G//g; is($s, "\x{123}", "#RT 126260 gofs"); } + +SKIP: { + if (! locales_enabled('LC_CTYPE')) { + skip "Can't test locale", 1; + } + + # To cause breakeage, we need a locale in which \xff matches whatever + # POSIX class is used in the pattern. Easiest is C, with \W. + fresh_perl_is(' use POSIX qw(locale_h); + setlocale(&POSIX::LC_CTYPE, "C"); + my $s = "\xff"; + $s =~ s/\W//l; + print qq(ok$s\n)', + "ok\n", + {stderr => 1 }, + '[perl #129038 ] s/\xff//l no longer crashes'); +} |