diff options
author | Karl Williamson <khw@cpan.org> | 2020-10-23 07:54:53 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2020-10-23 08:06:38 -0600 |
commit | bb58640a409949759318542317e353e2241cc408 (patch) | |
tree | e764c72af9040a2662cb46927d90106c51d79e4d /t/re/pat_advanced.t | |
parent | 28df11c0263c8ebd0e2bc0436b4a01c84279fc42 (diff) | |
download | perl-bb58640a409949759318542317e353e2241cc408.tar.gz |
Fix GH #17278
This was an assertion failure in regexec.c under rare circumstances. A
reduction of the fuzzed test case is now in pat_advanced.t
The root cause of this was that the pattern being compiled was encoded in
UTF-8 and 'use locale' was in effect, equivalent to the /l charset, and
then the charset was reset inside the pattern, to /d. But /d in a UTF-8
patterns is illegal, hence the later assertion failure.
The solution is to reset instead to /u when the pattern is UTF-8.
Diffstat (limited to 't/re/pat_advanced.t')
-rw-r--r-- | t/re/pat_advanced.t | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/t/re/pat_advanced.t b/t/re/pat_advanced.t index b8de776ae5..c469d5c59b 100644 --- a/t/re/pat_advanced.t +++ b/t/re/pat_advanced.t @@ -2562,6 +2562,20 @@ EOF {}, "GH #17734"); } + { # GH $17278 assertion fails + fresh_perl_is('use locale; + my $A_grave = "\N{LATIN CAPITAL LETTER A WITH GRAVE}"; + utf8::encode($A_grave); + my $a_grave = "\N{LATIN SMALL LETTER A WITH GRAVE}"; + utf8::encode($a_grave); + + my $z="q!$a_grave! =~ m!(?^i)[$A_grave]!"; + utf8::decode($z); + print eval $z, "\n";', + 1, + {}, "GH #17278"); + } + # !!! NOTE that tests that aren't at all likely to crash perl should go # a ways above, above these last ones. There's a comment there that, like |