summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2015-02-15 15:38:29 +0800
committerYves Orton <demerphq@gmail.com>2015-02-15 15:45:46 +0800
commite7267dfc40d2acfbd9b984b7da2585a62df1b772 (patch)
tree8fb51aa2fb7c3567397a69c007e7c589acb12e44 /regcomp.c
parent65651c16f0838dfd06a34694c4f84c5cb13354c2 (diff)
downloadperl-e7267dfc40d2acfbd9b984b7da2585a62df1b772.tar.gz
fix infinite loop in parsing backrefs in regex patterns
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/regcomp.c b/regcomp.c
index a761fd52a2..f26676b4be 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -12009,8 +12009,10 @@ S_regatom(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth)
/* bare \NNN might be backref or octal - if it is larger than or equal
* RExC_npar then it is assumed to be and octal escape.
* Note RExC_npar is +1 from the actual number of parens*/
- if (num == I32_MAX || (num > 9 && num >= RExC_npar
- && *RExC_parse != '8' && *RExC_parse != '9'))
+ /* Note we do NOT check if num == I32_MAX here, as that is
+ * handled by the RExC_npar check */
+ if (num > 9 && num >= RExC_npar
+ && *RExC_parse != '8' && *RExC_parse != '9')
{
/* Probably a character specified in octal, e.g. \35 */
goto defchar;