/[pcre]/code/trunk/pcre_compile.c
ViewVC logotype

Diff of /code/trunk/pcre_compile.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1534 by ph10, Tue Mar 24 10:33:21 2015 UTC revision 1535 by ph10, Wed Mar 25 16:51:51 2015 UTC
# Line 3093  Returns:      TRUE if the auto-possessif Line 3093  Returns:      TRUE if the auto-possessif
3093    
3094  static BOOL  static BOOL
3095  compare_opcodes(const pcre_uchar *code, BOOL utf, const compile_data *cd,  compare_opcodes(const pcre_uchar *code, BOOL utf, const compile_data *cd,
3096    const pcre_uint32 *base_list, const pcre_uchar *base_end)    const pcre_uint32 *base_list, const pcre_uchar *base_end, int *rec_limit)
3097  {  {
3098  pcre_uchar c;  pcre_uchar c;
3099  pcre_uint32 list[8];  pcre_uint32 list[8];
# Line 3110  pcre_uint32 chr; Line 3110  pcre_uint32 chr;
3110  BOOL accepted, invert_bits;  BOOL accepted, invert_bits;
3111  BOOL entered_a_group = FALSE;  BOOL entered_a_group = FALSE;
3112    
3113    if (*rec_limit == 0) return FALSE;
3114    --(*rec_limit);
3115    
3116  /* Note: the base_list[1] contains whether the current opcode has greedy  /* Note: the base_list[1] contains whether the current opcode has greedy
3117  (represented by a non-zero value) quantifier. This is a different from  (represented by a non-zero value) quantifier. This is a different from
3118  other character type lists, which stores here that the character iterator  other character type lists, which stores here that the character iterator
# Line 3180  for(;;) Line 3183  for(;;)
3183    
3184      while (*next_code == OP_ALT)      while (*next_code == OP_ALT)
3185        {        {
3186        if (!compare_opcodes(code, utf, cd, base_list, base_end)) return FALSE;        if (!compare_opcodes(code, utf, cd, base_list, base_end, rec_limit))
3187            return FALSE;
3188        code = next_code + 1 + LINK_SIZE;        code = next_code + 1 + LINK_SIZE;
3189        next_code += GET(next_code, 1);        next_code += GET(next_code, 1);
3190        }        }
# Line 3200  for(;;) Line 3204  for(;;)
3204      /* The bracket content will be checked by the      /* The bracket content will be checked by the
3205      OP_BRA/OP_CBRA case above. */      OP_BRA/OP_CBRA case above. */
3206      next_code += 1 + LINK_SIZE;      next_code += 1 + LINK_SIZE;
3207      if (!compare_opcodes(next_code, utf, cd, base_list, base_end))      if (!compare_opcodes(next_code, utf, cd, base_list, base_end, rec_limit))
3208        return FALSE;        return FALSE;
3209    
3210      code += PRIV(OP_lengths)[c];      code += PRIV(OP_lengths)[c];
# Line 3633  register pcre_uchar c; Line 3637  register pcre_uchar c;
3637  const pcre_uchar *end;  const pcre_uchar *end;
3638  pcre_uchar *repeat_opcode;  pcre_uchar *repeat_opcode;
3639  pcre_uint32 list[8];  pcre_uint32 list[8];
3640    int rec_limit;
3641    
3642  for (;;)  for (;;)
3643    {    {
# Line 3653  for (;;) Line 3658  for (;;)
3658        get_chr_property_list(code, utf, cd->fcc, list) : NULL;        get_chr_property_list(code, utf, cd->fcc, list) : NULL;
3659      list[1] = c == OP_STAR || c == OP_PLUS || c == OP_QUERY || c == OP_UPTO;      list[1] = c == OP_STAR || c == OP_PLUS || c == OP_QUERY || c == OP_UPTO;
3660    
3661      if (end != NULL && compare_opcodes(end, utf, cd, list, end))      rec_limit = 10000;
3662        if (end != NULL && compare_opcodes(end, utf, cd, list, end, &rec_limit))
3663        {        {
3664        switch(c)        switch(c)
3665          {          {
# Line 3709  for (;;) Line 3715  for (;;)
3715    
3716        list[1] = (c & 1) == 0;        list[1] = (c & 1) == 0;
3717    
3718        if (compare_opcodes(end, utf, cd, list, end))        rec_limit = 10000;
3719          if (compare_opcodes(end, utf, cd, list, end, &rec_limit))
3720          {          {
3721          switch (c)          switch (c)
3722            {            {

Legend:
Removed from v.1534  
changed lines
  Added in v.1535

  ViewVC Help
Powered by ViewVC 1.1.5