This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.c: Fix some parsing glitches
authorKarl Williamson <khw@cpan.org>
Wed, 10 Feb 2016 23:27:13 +0000 (16:27 -0700)
committerKarl Williamson <khw@cpan.org>
Thu, 11 Feb 2016 04:16:43 +0000 (21:16 -0700)
commitcfbef7dc3bfb89e4ed2c00ea9c9e3bcfd0b170fd
tree925bd3a138ea1fad8346715d507ac8baf4131460
parent6421685ecc2e22ca71451c4a545a2a2593260491
regcomp.c: Fix some parsing glitches

I undertook a code review of how regcomp.c parses things in light of the
tickets found by the fuzzer,
https://rt.perl.org/Ticket/Display.html?id=126546.  This commit is the
result of my efforts so far.  I was not planning to push it now, but the
work found a couple of new error messages that should be raised, and
this has to be done before the visible changes code freeze coming up all
too soon.  I will add test cases after that freeze, including if to see
that these changes fix all the observed issues.

The audit was tedious, and may have missed some things.  Several issues
occurred in multiple places.  One is to not advance the parse by
UTF8SKIP appropriately; another is to subtract one byte from the parse
and assume that that is pointing to the beginning of the previous
character (which under UTF-8 it may not).  Another is to assume that
that the pattern is a C string, that there are no interior NULs in it.
I also found unnecessary tests, given that an SV always has a
terminating NUL.
pod/perldelta.pod
pod/perldiag.pod
regcomp.c