diff options
author | Karl Williamson <khw@cpan.org> | 2017-12-18 19:04:56 -0700 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2017-12-18 19:10:52 -0700 |
commit | 2a6971a9d6e731d8d1d38fd2533d01eb975f7a4d (patch) | |
tree | 856af12d312e92a1ee3ea1e188bce048c83ae01b /regcomp.c | |
parent | 0202c428e2e1febe76c0cfbb1a64a76cd3f6f756 (diff) | |
download | perl-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.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -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 */ |