Ignore:
Timestamp:
Dec 29, 2006, 7:03:43 PM (18 years ago)
Author:
ddkilzer
Message:

2006-12-29 David Kilzer <[email protected]>

Reviewed by Geoff.

Update embedded pcre library from version 6.1 to 6.2. From the pcre ChangeLog:

  1. Added "b" to the 2nd argument of fopen() in dftables.c, for non-Unix-like operating environments where this matters.
  1. Named capturing subpatterns were not being correctly counted when a pattern was compiled. This caused two problems: (a) If there were more than 100 such subpatterns, the calculation of the memory needed for the whole compiled pattern went wrong, leading to an overflow error. (b) Numerical back references of the form \12, where the number was greater than 9, were not recognized as back references, even though there were sufficient previous subpatterns.
  • pcre/dftables.c: Item 3. (main):
  • pcre/pcre.h: Updated version.
  • pcre/pcre_compile.c: Item 5. (read_repeat_counts): (pcre_compile2):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/pcre/pcre_compile.c

    r17372 r18483  
    718718int max = -1;
    719719
     720/* Read the minimum value and do a paranoid check: a negative value indicates
     721an integer overflow. */
     722
    720723while ((DIGITAB(*p) & ctype_digit) != 0) min = min * 10 + *p++ - '0';
    721724if (min < 0 || min > 65535)
     
    724727    return p;
    725728  }
     729
     730/* Read the maximum value if there is one, and again do a paranoid on its size.
     731Also, max must not be less than min. */
    726732
    727733if (*p == '}') max = min; else
     
    39163922#endif
    39173923BOOL inescq = FALSE;
     3924BOOL capturing;
    39183925unsigned int brastackptr = 0;
    39193926size_t size;
     
    44804487    branch_newextra = 0;
    44814488    bracket_length = 1 + LINK_SIZE;
     4489    capturing = FALSE;
    44824490
    44834491    /* Handle special forms of bracket, which all start (? */
     
    45724580        case 'P':
    45734581        ptr += 3;
     4582
     4583        /* Handle the definition of a named subpattern */
     4584
    45744585        if (*ptr == '<')
    45754586          {
     
    45844595          name_count++;
    45854596          if (ptr - p > max_name_size) max_name_size = INT_CAST(ptr - p);
     4597          capturing = TRUE;   /* Named parentheses are always capturing */
    45864598          break;
    45874599          }
     4600
     4601        /* Handle back references and recursive calls to named subpatterns */
    45884602
    45894603        if (*ptr == '=' || *ptr == '>')
     
    47724786          }
    47734787
    4774         /* If options were terminated by ':' control comes here. Fall through
    4775         to handle the group below. */
     4788        /* If options were terminated by ':' control comes here. This is a
     4789        non-capturing group with an options change. There is nothing more that
     4790        needs to be done because "capturing" is already set FALSE by default;
     4791        we can just fall through. */
     4792
    47764793        }
    47774794      }
    47784795
    4779     /* Extracting brackets must be counted so we can process escapes in a
    4780     Perlish way. If the number exceeds EXTRACT_BASIC_MAX we are going to
    4781     need an additional 3 bytes of store per extracting bracket. However, if
    4782     PCRE_NO_AUTO)CAPTURE is set, unadorned brackets become non-capturing, so we
    4783     must leave the count alone (it will aways be zero). */
    4784 
    4785     else if ((options & PCRE_NO_AUTO_CAPTURE) == 0)
     4796    /* Ordinary parentheses, not followed by '?', are capturing unless
     4797    PCRE_NO_AUTO_CAPTURE is set. */
     4798
     4799    else capturing = (options & PCRE_NO_AUTO_CAPTURE) == 0;
     4800
     4801    /* Capturing brackets must be counted so we can process escapes in a
     4802    Perlish way. If the number exceeds EXTRACT_BASIC_MAX we are going to need
     4803    an additional 3 bytes of memory per capturing bracket. */
     4804
     4805    if (capturing)
    47864806      {
    47874807      bracount++;
Note: See TracChangeset for help on using the changeset viewer.