Skip to content

Commit

Permalink
Small PR tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
NWilson committed Nov 8, 2024
1 parent c17e086 commit 5c714ca
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/pcre2_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -1277,7 +1277,7 @@ if (allow_sign >= 0 && sign != 0)
}

if (sign > 0) n += allow_sign;
else if ((int)n > allow_sign)
else if (n > (uint32_t)allow_sign)
{
*errorcodeptr = ERR15; /* Non-existent subpattern */
goto EXIT;
Expand Down Expand Up @@ -3650,10 +3650,12 @@ while (ptr < ptrend)
goto FAILED;
}

/* Jump here from '(?[...])'. */

class_mode_state = ((options & PCRE2_ALT_EXTENDED_CLASS) != 0)?
CLASS_MODE_ALT_EXT : CLASS_MODE_NORMAL;

/* Jump here from '(?[...])'. That jump must initialize class_mode_state,
set c to the '[' character, and ptr to just after the '['. */

FROM_PERL_EXTENDED_CLASS:
okquantifier = TRUE;

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

Expand Down

0 comments on commit 5c714ca

Please sign in to comment.