This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Off-by-one in PL_fold_locale use.
authorJarkko Hietaniemi <jhi@iki.fi>
Wed, 7 May 2014 13:19:00 +0000 (09:19 -0400)
committerSteffen Mueller <smueller@cpan.org>
Wed, 28 May 2014 13:20:53 +0000 (15:20 +0200)
commite8ea8356d847d9e52f20d12b33fbd589beced868
treee20fa94039e44e547c6f85f8ae73aea9070a383a
parent3f49e765225af085951605f8b1c60eadd98ef39f
Off-by-one in PL_fold_locale use.

Fix for Coverity perl5 CID 29033: Out-of-bounds read
 (OVERRUN) overrun-local: Overrunning array PL_fold_locale of 256 bytes at
 byte offset 256 using index c1 (which evaluates to 256).

- the "c1 > 256" was off-by-one, it needed to be "c1 > 255",
  it could have caused the PL_fold_locale to be accessed one past the end,
  at offset 256, but we have dodged the bullet thanks to the regex engine
  optimizing the bad case away before we hit it (analysis by Karl Williamson):
  regexec.c
- comment fixes (pointed out by Karl Williamson): regexec.c
- add tests to nail down the behaviour of fold matching
  for the last of Latin-1 (0xFF, lowercase which curiously does not have
  uppercase within Latin-1). and the first pure Unicode: t/re/pat.t
regexec.c
t/re/pat.t