Skip to content

Commit 5c714ca

Browse files
committed
Small PR tweaks
1 parent c17e086 commit 5c714ca

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/pcre2_compile.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,7 +1277,7 @@ if (allow_sign >= 0 && sign != 0)
12771277
}
12781278

12791279
if (sign > 0) n += allow_sign;
1280-
else if ((int)n > allow_sign)
1280+
else if (n > (uint32_t)allow_sign)
12811281
{
12821282
*errorcodeptr = ERR15; /* Non-existent subpattern */
12831283
goto EXIT;
@@ -3650,10 +3650,12 @@ while (ptr < ptrend)
36503650
goto FAILED;
36513651
}
36523652

3653-
/* Jump here from '(?[...])'. */
3654-
36553653
class_mode_state = ((options & PCRE2_ALT_EXTENDED_CLASS) != 0)?
36563654
CLASS_MODE_ALT_EXT : CLASS_MODE_NORMAL;
3655+
3656+
/* Jump here from '(?[...])'. That jump must initialize class_mode_state,
3657+
set c to the '[' character, and ptr to just after the '['. */
3658+
36573659
FROM_PERL_EXTENDED_CLASS:
36583660
okquantifier = TRUE;
36593661

@@ -4947,12 +4949,7 @@ while (ptr < ptrend)
49474949
(IS_DIGIT(*ptr))? -1:(int)(cb->bracount), /* + and - are relative */
49484950
MAX_GROUP_NUMBER, ERR61,
49494951
&i, &errorcode)) goto FAILED;
4950-
if (i < 0) /* NB (?0) is permitted */
4951-
{
4952-
// XXX Can we change this block to be PCRE2_ASSERT(i >= 0)? How can read_number return a negative value?
4953-
errorcode = ERR15; /* Unknown group */
4954-
goto FAILED_BACK;
4955-
}
4952+
PCRE2_ASSERT(i >= 0); /* NB (?0) is permitted, represented by i=0 */
49564953
if (ptr >= ptrend || *ptr != CHAR_RIGHT_PARENTHESIS)
49574954
goto UNCLOSED_PARENTHESIS;
49584955

0 commit comments

Comments
 (0)