summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2017-12-18 19:04:56 -0700
committerKarl Williamson <khw@cpan.org>2017-12-18 19:10:52 -0700
commit2a6971a9d6e731d8d1d38fd2533d01eb975f7a4d (patch)
tree856af12d312e92a1ee3ea1e188bce048c83ae01b /regcomp.c
parent0202c428e2e1febe76c0cfbb1a64a76cd3f6f756 (diff)
downloadperl-2a6971a9d6e731d8d1d38fd2533d01eb975f7a4d.tar.gz
Forbid literal \v in /[]/ under re strict, except under /x
Vertical space in a bracketed character class is likely to be an error; either a typo or omission of /x. It will match literally, but be displayed like /x is in effect. For now, just add this check to re 'strict', which is experimental, designed to catch things the current regex parser doesn't.
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/regcomp.c b/regcomp.c
index 1739dabbb7..50f5ee866e 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -16225,6 +16225,12 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth,
do_posix_warnings ? &posix_warnings : NULL,
TRUE /* checking only */);
}
+ else if ( strict && ! skip_white
+ && ( _generic_isCC(value, _CC_VERTSPACE)
+ || is_VERTWS_cp_high(value)))
+ {
+ vFAIL("Literal vertical space in [] is illegal except under /x");
+ }
else if (value == '\\') {
/* Is a backslash; get the code point of the char after it */