This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regexec.c: Fix bugs in regrepeat()
authorKarl Williamson <public@khwilliamson.com>
Fri, 19 Oct 2012 17:08:35 +0000 (11:08 -0600)
committerKarl Williamson <public@khwilliamson.com>
Fri, 19 Oct 2012 17:31:00 +0000 (11:31 -0600)
commit4063ade8503ac8877a02fc4eae8ebbe242b9110b
treee722406dc642ba4792414cd3851698e5c16d7fd2
parent5771dda049fadfc47ba87778f8b27cf556dc81d2
regexec.c: Fix bugs in regrepeat()

I realized that commit 613a425dda0dc9e3f838151a5d796c902cfd922e
introduced some bugs into regrepeat().  In looking over the code more
closely, I realized that there were longstanding problems there of a
similar nature.  However, I was unable, for the most part, to come up
with tests that showed up these bugs, and that may explain why there
haven't been field reports for them.  The situations that lead to
problems are typically caught before regrepeat() gets executed.

The problem was that the situation in this function is different
depending on whether the target string is encoded in UTF-8 or not, and
not all of the cases in the switch statement followed that.  I have now
changed things, so that for both the UTF-8 and non-UTF-8 cases, the
switch is entered with things set up so that there is no extra set-up
needed for the most common situation; and comments now explain things.
regexec.c
t/re/re_tests