This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
PATCH: [perl #133992] Assertion failure in scan_const
authorKarl Williamson <khw@cpan.org>
Sat, 6 Apr 2019 18:38:56 +0000 (12:38 -0600)
committerKarl Williamson <khw@cpan.org>
Wed, 10 Apr 2019 19:44:24 +0000 (13:44 -0600)
commitf339d50eda7719c09cc74ada05d55546a7984b73
tree129135f0a5b0d6ca46193cb2b70724ecdf35cadd
parent1759517a0ada946c6a4354390fc8aa965ac93c48
PATCH: [perl #133992] Assertion failure in scan_const

I haven't done the digging, but this appears to be a failure to include
UTF-8 processing when 'use utf8' was added to Perl.

The code that was causing this in toke.c had found a qr/(?#... beginning
of comment in a pattern.  It attempted to space up to but not including
the final character, which is handled later.  (In most instances that
final character is a single-byte ')', but not in this test case.  It
spaced per-byte.  The problem is that if the final character is in UTF-8
and isn't a single byte, it leaves the input position pointing at the
final byte of that character, which creates malformed UTF-8, which the
assertion discovered.

The fix is to be cognizant that this is UTF-8 when spacing to the end,
so that the final position begins at the first byte of it.
t/re/pat.t
toke.c