diff options
author | Yves Orton <demerphq@gmail.com> | 2015-02-15 15:38:29 +0800 |
---|---|---|
committer | Yves Orton <demerphq@gmail.com> | 2015-02-15 15:45:46 +0800 |
commit | e7267dfc40d2acfbd9b984b7da2585a62df1b772 (patch) | |
tree | 8fb51aa2fb7c3567397a69c007e7c589acb12e44 /regcomp.c | |
parent | 65651c16f0838dfd06a34694c4f84c5cb13354c2 (diff) | |
download | perl-e7267dfc40d2acfbd9b984b7da2585a62df1b772.tar.gz |
fix infinite loop in parsing backrefs in regex patterns
Diffstat (limited to 'regcomp.c')
-rw-r--r-- | regcomp.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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; |