/[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 503 by ph10, Sun Mar 7 17:35:52 2010 UTC revision 505 by ph10, Tue Mar 9 16:50:47 2010 UTC
# Line 92  is 4 there is plenty of room. */ Line 92  is 4 there is plenty of room. */
92    
93  #define COMPILE_WORK_SIZE (4096)  #define COMPILE_WORK_SIZE (4096)
94    
95    /* The overrun tests check for a slightly smaller size so that they detect the
96    overrun before it actually does run off the end of the data block. */
97    
98    #define WORK_SIZE_CHECK (COMPILE_WORK_SIZE - 100)
99    
100    
101  /* Table for handling escaped characters in the range '0'-'z'. Positive returns  /* Table for handling escaped characters in the range '0'-'z'. Positive returns
102  are simple data values; negative values are for special things like \d and so  are simple data values; negative values are for special things like \d and so
# Line 1828  for (code = first_significant_code(code Line 1833  for (code = first_significant_code(code
1833    
1834    if (c == OP_RECURSE)    if (c == OP_RECURSE)
1835      {      {
1836        BOOL empty_branch = FALSE;
1837      const uschar *scode = cd->start_code + GET(code, 1);      const uschar *scode = cd->start_code + GET(code, 1);
1838      if (GET(scode, 1) == 0) return TRUE;    /* Unclosed */      if (GET(scode, 1) == 0) return TRUE;    /* Unclosed */
1839      do      do
1840        {        {
1841        if (!could_be_empty_branch(scode, endcode, utf8, cd)) return FALSE;        if (could_be_empty_branch(scode, endcode, utf8, cd))
1842            {
1843            empty_branch = TRUE;
1844            break;
1845            }
1846        scode += GET(scode, 1);        scode += GET(scode, 1);
1847        }        }
1848      while (*scode == OP_ALT);      while (*scode == OP_ALT);
1849        if (!empty_branch) return FALSE;  /* All branches are non-empty */
1850      continue;      continue;
1851      }      }
1852    
# Line 2754  for (;; ptr++) Line 2765  for (;; ptr++)
2765  #ifdef PCRE_DEBUG  #ifdef PCRE_DEBUG
2766      if (code > cd->hwm) cd->hwm = code;                 /* High water info */      if (code > cd->hwm) cd->hwm = code;                 /* High water info */
2767  #endif  #endif
2768      if (code > cd->start_workspace + COMPILE_WORK_SIZE) /* Check for overrun */      if (code > cd->start_workspace + WORK_SIZE_CHECK)   /* Check for overrun */
2769        {        {
2770        *errorcodeptr = ERR52;        *errorcodeptr = ERR52;
2771        goto FAILED;        goto FAILED;
# Line 2803  for (;; ptr++) Line 2814  for (;; ptr++)
2814    /* In the real compile phase, just check the workspace used by the forward    /* In the real compile phase, just check the workspace used by the forward
2815    reference list. */    reference list. */
2816    
2817    else if (cd->hwm > cd->start_workspace + COMPILE_WORK_SIZE)    else if (cd->hwm > cd->start_workspace + WORK_SIZE_CHECK)
2818      {      {
2819      *errorcodeptr = ERR52;      *errorcodeptr = ERR52;
2820      goto FAILED;      goto FAILED;

Legend:
Removed from v.503  
changed lines
  Added in v.505

  ViewVC Help
Powered by ViewVC 1.1.5