diff options
author | Leon Timmermans <fawaka@gmail.com> | 2021-04-19 18:49:52 +0200 |
---|---|---|
committer | Leon Timmermans <fawaka@gmail.com> | 2021-05-24 13:56:14 +0200 |
commit | e6e9dd290698d47a0db9e1d676d2b82e0bb0a52b (patch) | |
tree | e0122058bbf0ffb5df1de8d5af2088d6b98959f6 /t | |
parent | 18e5156b1786a26cd70a7f8ff84c10956d93faf3 (diff) | |
download | perl-e6e9dd290698d47a0db9e1d676d2b82e0bb0a52b.tar.gz |
Do not cache utf8 offsets for non-canonical lengths
In particular, if the length is beyond the end, it should not be stored as the end.
Diffstat (limited to 't')
-rw-r--r-- | t/op/index.t | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/t/op/index.t b/t/op/index.t index 2f0834e8d1..a218848851 100644 --- a/t/op/index.t +++ b/t/op/index.t @@ -8,7 +8,7 @@ BEGIN { } use strict; -plan( tests => 414 ); +plan( tests => 415 ); run_tests() unless caller; @@ -358,4 +358,12 @@ $x; EOS } + { + my $s = "abc"; + my $len = length($s); + utf8::upgrade($s); + length($s); + is(index($s, "", $len+1), 3, 'Overlong index doesn\'t confuse utf8 cache'); + } + } # end of sub run_tests |