This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.c: Keep parse pointer on full character boundary
authorKarl Williamson <khw@cpan.org>
Tue, 20 Oct 2015 17:23:40 +0000 (11:23 -0600)
committerKarl Williamson <khw@cpan.org>
Tue, 20 Oct 2015 17:31:30 +0000 (11:31 -0600)
I think, but am unsure, that this commit isn't necessary.  Without it,
the parse pointer can point to an interior byte of a multi-byte
character.  Recent work has sensitized me to trying to avoid this.  So
this commit advances the pointer a full character width at a time.

regcomp.c

index beec98d..611cc1c 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -13446,7 +13446,7 @@ S_handle_regex_sets(pTHX_ RExC_state_t *pRExC_state, SV** return_invlist,
                     RExC_parse++;
                     if (*RExC_parse == 'c') {
                             /* Skip the \cX notation for control characters */
-                            RExC_parse++;
+                            RExC_parse += UTF ? UTF8SKIP(RExC_parse) : 1;
                     }
                     break;
                 case '[':