/[pcre]/code/tags/pcre-7.7/pcre_compile.c
ViewVC logotype

Diff of /code/tags/pcre-7.7/pcre_compile.c

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

revision 107 by ph10, Wed Mar 7 11:02:28 2007 UTC revision 218 by ph10, Thu Aug 16 10:13:23 2007 UTC
# Line 6  Line 6 
6  and semantics are as close as possible to those of the Perl 5 language.  and semantics are as close as possible to those of the Perl 5 language.
7    
8                         Written by Philip Hazel                         Written by Philip Hazel
9             Copyright (c) 1997-2006 University of Cambridge             Copyright (c) 1997-2007 University of Cambridge
10    
11  -----------------------------------------------------------------------------  -----------------------------------------------------------------------------
12  Redistribution and use in source and binary forms, with or without  Redistribution and use in source and binary forms, with or without
# Line 42  POSSIBILITY OF SUCH DAMAGE. Line 42  POSSIBILITY OF SUCH DAMAGE.
42  supporting internal functions that are not used by other modules. */  supporting internal functions that are not used by other modules. */
43    
44    
45    #ifdef HAVE_CONFIG_H
46    #include <config.h>
47    #endif
48    
49  #define NLBLOCK cd             /* Block containing newline information */  #define NLBLOCK cd             /* Block containing newline information */
50  #define PSSTART start_pattern  /* Field containing processed string start */  #define PSSTART start_pattern  /* Field containing processed string start */
51  #define PSEND   end_pattern    /* Field containing processed string end */  #define PSEND   end_pattern    /* Field containing processed string end */
52    
   
53  #include "pcre_internal.h"  #include "pcre_internal.h"
54    
55    
# Line 58  used by pcretest. DEBUG is not defined w Line 61  used by pcretest. DEBUG is not defined w
61  #endif  #endif
62    
63    
64    /* Macro for setting individual bits in class bitmaps. */
65    
66    #define SETBIT(a,b) a[b/8] |= (1 << (b%8))
67    
68    /* Maximum length value to check against when making sure that the integer that
69    holds the compiled pattern length does not overflow. We make it a bit less than
70    INT_MAX to allow for adding in group terminating bytes, so that we don't have
71    to check them every time. */
72    
73    #define OFLOW_MAX (INT_MAX - 20)
74    
75    
76  /*************************************************  /*************************************************
77  *      Code parameters and static tables         *  *      Code parameters and static tables         *
78  *************************************************/  *************************************************/
# Line 87  static const short int escapes[] = { Line 102  static const short int escapes[] = {
102       0,      0,      0,      0,      0,      0,      0,      0,   /* 0 - 7 */       0,      0,      0,      0,      0,      0,      0,      0,   /* 0 - 7 */
103       0,      0,    ':',    ';',    '<',    '=',    '>',    '?',   /* 8 - ? */       0,      0,    ':',    ';',    '<',    '=',    '>',    '?',   /* 8 - ? */
104     '@', -ESC_A, -ESC_B, -ESC_C, -ESC_D, -ESC_E,      0, -ESC_G,   /* @ - G */     '@', -ESC_A, -ESC_B, -ESC_C, -ESC_D, -ESC_E,      0, -ESC_G,   /* @ - G */
105       0,      0,      0,      0,      0,      0,      0,      0,   /* H - O */  -ESC_H,      0,      0, -ESC_K,      0,      0,      0,      0,   /* H - O */
106  -ESC_P, -ESC_Q, -ESC_R, -ESC_S,      0,      0,      0, -ESC_W,   /* P - W */  -ESC_P, -ESC_Q, -ESC_R, -ESC_S,      0,      0, -ESC_V, -ESC_W,   /* P - W */
107  -ESC_X,      0, -ESC_Z,    '[',   '\\',    ']',    '^',    '_',   /* X - _ */  -ESC_X,      0, -ESC_Z,    '[',   '\\',    ']',    '^',    '_',   /* X - _ */
108     '`',      7, -ESC_b,      0, -ESC_d,  ESC_e,  ESC_f,      0,   /* ` - g */     '`',      7, -ESC_b,      0, -ESC_d,  ESC_e,  ESC_f,      0,   /* ` - g */
109       0,      0,      0, -ESC_k,      0,      0,  ESC_n,      0,   /* h - o */  -ESC_h,      0,      0, -ESC_k,      0,      0,  ESC_n,      0,   /* h - o */
110  -ESC_p,      0,  ESC_r, -ESC_s,  ESC_tee,    0,      0, -ESC_w,   /* p - w */  -ESC_p,      0,  ESC_r, -ESC_s,  ESC_tee,    0, -ESC_v, -ESC_w,   /* p - w */
111       0,      0, -ESC_z                                            /* x - z */       0,      0, -ESC_z                                            /* x - z */
112  };  };
113    
# Line 106  static const short int escapes[] = { Line 121  static const short int escapes[] = {
121  /*  70 */     0,     0,      0,       0,      0,     0,      0,      0,  /*  70 */     0,     0,      0,       0,      0,     0,      0,      0,
122  /*  78 */     0,   '`',    ':',     '#',    '@',  '\'',    '=',    '"',  /*  78 */     0,   '`',    ':',     '#',    '@',  '\'',    '=',    '"',
123  /*  80 */     0,     7, -ESC_b,       0, -ESC_d, ESC_e,  ESC_f,      0,  /*  80 */     0,     7, -ESC_b,       0, -ESC_d, ESC_e,  ESC_f,      0,
124  /*  88 */     0,     0,      0,     '{',      0,     0,      0,      0,  /*  88 */-ESC_h,     0,      0,     '{',      0,     0,      0,      0,
125  /*  90 */     0,     0, -ESC_k,     'l',      0, ESC_n,      0, -ESC_p,  /*  90 */     0,     0, -ESC_k,     'l',      0, ESC_n,      0, -ESC_p,
126  /*  98 */     0, ESC_r,      0,     '}',      0,     0,      0,      0,  /*  98 */     0, ESC_r,      0,     '}',      0,     0,      0,      0,
127  /*  A0 */     0,   '~', -ESC_s, ESC_tee,      0,     0, -ESC_w,      0,  /*  A0 */     0,   '~', -ESC_s, ESC_tee,      0,-ESC_v, -ESC_w,      0,
128  /*  A8 */     0,-ESC_z,      0,       0,      0,   '[',      0,      0,  /*  A8 */     0,-ESC_z,      0,       0,      0,   '[',      0,      0,
129  /*  B0 */     0,     0,      0,       0,      0,     0,      0,      0,  /*  B0 */     0,     0,      0,       0,      0,     0,      0,      0,
130  /*  B8 */     0,     0,      0,       0,      0,   ']',    '=',    '-',  /*  B8 */     0,     0,      0,       0,      0,   ']',    '=',    '-',
131  /*  C0 */   '{',-ESC_A, -ESC_B,  -ESC_C, -ESC_D,-ESC_E,      0, -ESC_G,  /*  C0 */   '{',-ESC_A, -ESC_B,  -ESC_C, -ESC_D,-ESC_E,      0, -ESC_G,
132  /*  C8 */     0,     0,      0,       0,      0,     0,      0,      0,  /*  C8 */-ESC_H,     0,      0,       0,      0,     0,      0,      0,
133  /*  D0 */   '}',     0,      0,       0,      0,     0,      0, -ESC_P,  /*  D0 */   '}',     0, -ESC_K,       0,      0,     0,      0, -ESC_P,
134  /*  D8 */-ESC_Q,-ESC_R,      0,       0,      0,     0,      0,      0,  /*  D8 */-ESC_Q,-ESC_R,      0,       0,      0,     0,      0,      0,
135  /*  E0 */  '\\',     0, -ESC_S,       0,      0,     0, -ESC_W, -ESC_X,  /*  E0 */  '\\',     0, -ESC_S,       0,      0,-ESC_V, -ESC_W, -ESC_X,
136  /*  E8 */     0,-ESC_Z,      0,       0,      0,     0,      0,      0,  /*  E8 */     0,-ESC_Z,      0,       0,      0,     0,      0,      0,
137  /*  F0 */     0,     0,      0,       0,      0,     0,      0,      0,  /*  F0 */     0,     0,      0,       0,      0,     0,      0,      0,
138  /*  F8 */     0,     0,      0,       0,      0,     0,      0,      0  /*  F8 */     0,     0,      0,       0,      0,     0,      0,      0
# Line 125  static const short int escapes[] = { Line 140  static const short int escapes[] = {
140  #endif  #endif
141    
142    
143    /* Table of special "verbs" like (*PRUNE) */
144    
145    typedef struct verbitem {
146      const char *name;
147      int   len;
148      int   op;
149    } verbitem;
150    
151    static verbitem verbs[] = {
152      { "ACCEPT", 6, OP_ACCEPT },
153      { "COMMIT", 6, OP_COMMIT },
154      { "F",      1, OP_FAIL },
155      { "FAIL",   4, OP_FAIL },
156      { "PRUNE",  5, OP_PRUNE },
157      { "SKIP",   4, OP_SKIP  },
158      { "THEN",   4, OP_THEN  }
159    };
160    
161    static int verbcount = sizeof(verbs)/sizeof(verbitem);
162    
163    
164  /* Tables of names of POSIX character classes and their lengths. The list is  /* Tables of names of POSIX character classes and their lengths. The list is
165  terminated by a zero length entry. The first three must be alpha, lower, upper,  terminated by a zero length entry. The first three must be alpha, lower, upper,
166  as this is assumed for handling case independence. */  as this is assumed for handling case independence. */
# Line 198  static const char *error_texts[] = { Line 234  static const char *error_texts[] = {
234    "missing ) after comment",    "missing ) after comment",
235    "parentheses nested too deeply",  /** DEAD **/    "parentheses nested too deeply",  /** DEAD **/
236    /* 20 */    /* 20 */
237    "regular expression too large",    "regular expression is too large",
238    "failed to get memory",    "failed to get memory",
239    "unmatched parentheses",    "unmatched parentheses",
240    "internal error: code overflow",    "internal error: code overflow",
# Line 208  static const char *error_texts[] = { Line 244  static const char *error_texts[] = {
244    "malformed number or name after (?(",    "malformed number or name after (?(",
245    "conditional group contains more than two branches",    "conditional group contains more than two branches",
246    "assertion expected after (?(",    "assertion expected after (?(",
247    "(?R or (?digits must be followed by )",    "(?R or (?[+-]digits must be followed by )",
248    /* 30 */    /* 30 */
249    "unknown POSIX class name",    "unknown POSIX class name",
250    "POSIX collating elements are not supported",    "POSIX collating elements are not supported",
# Line 234  static const char *error_texts[] = { Line 270  static const char *error_texts[] = {
270    "subpattern name is too long (maximum " XSTRING(MAX_NAME_SIZE) " characters)",    "subpattern name is too long (maximum " XSTRING(MAX_NAME_SIZE) " characters)",
271    "too many named subpatterns (maximum " XSTRING(MAX_NAME_COUNT) ")",    "too many named subpatterns (maximum " XSTRING(MAX_NAME_COUNT) ")",
272    /* 50 */    /* 50 */
273    "repeated subpattern is too long",    "repeated subpattern is too long",    /** DEAD **/
274    "octal value is greater than \\377 (not in UTF-8 mode)",    "octal value is greater than \\377 (not in UTF-8 mode)",
275    "internal error: overran compiling workspace",    "internal error: overran compiling workspace",
276    "internal error: previously-checked referenced subpattern not found",    "internal error: previously-checked referenced subpattern not found",
# Line 242  static const char *error_texts[] = { Line 278  static const char *error_texts[] = {
278    /* 55 */    /* 55 */
279    "repeating a DEFINE group is not allowed",    "repeating a DEFINE group is not allowed",
280    "inconsistent NEWLINE options",    "inconsistent NEWLINE options",
281    "\\g is not followed by an (optionally braced) non-zero number"    "\\g is not followed by a braced name or an optionally braced non-zero number",
282      "(?+ or (?- or (?(+ or (?(- must be followed by a non-zero number",
283      "(*VERB) with an argument is not supported",
284      /* 60 */
285      "(*VERB) not recognized",
286      "number is too big"
287  };  };
288    
289    
# Line 373  static const unsigned char ebcdic_charta Line 414  static const unsigned char ebcdic_charta
414  /* Definition to allow mutual recursion */  /* Definition to allow mutual recursion */
415    
416  static BOOL  static BOOL
417    compile_regex(int, int, uschar **, const uschar **, int *, BOOL, int, int *,    compile_regex(int, int, uschar **, const uschar **, int *, BOOL, BOOL, int,
418      int *, branch_chain *, compile_data *, int *);      int *, int *, branch_chain *, compile_data *, int *);
419    
420    
421    
# Line 399  Arguments: Line 440  Arguments:
440    
441  Returns:         zero or positive => a data character  Returns:         zero or positive => a data character
442                   negative => a special escape sequence                   negative => a special escape sequence
443                   on error, errorptr is set                   on error, errorcodeptr is set
444  */  */
445    
446  static int  static int
# Line 452  else Line 493  else
493    
494      /* \g must be followed by a number, either plain or braced. If positive, it      /* \g must be followed by a number, either plain or braced. If positive, it
495      is an absolute backreference. If negative, it is a relative backreference.      is an absolute backreference. If negative, it is a relative backreference.
496      This is a Perl 5.10 feature. */      This is a Perl 5.10 feature. Perl 5.10 also supports \g{name} as a
497        reference to a named group. This is part of Perl's movement towards a
498        unified syntax for back references. As this is synonymous with \k{name}, we
499        fudge it up by pretending it really was \k. */
500    
501      case 'g':      case 'g':
502      if (ptr[1] == '{')      if (ptr[1] == '{')
503        {        {
504          const uschar *p;
505          for (p = ptr+2; *p != 0 && *p != '}'; p++)
506            if (*p != '-' && (digitab[*p] & ctype_digit) == 0) break;
507          if (*p != 0 && *p != '}')
508            {
509            c = -ESC_k;
510            break;
511            }
512        braced = TRUE;        braced = TRUE;
513        ptr++;        ptr++;
514        }        }
# Line 472  else Line 524  else
524      c = 0;      c = 0;
525      while ((digitab[ptr[1]] & ctype_digit) != 0)      while ((digitab[ptr[1]] & ctype_digit) != 0)
526        c = c * 10 + *(++ptr) - '0';        c = c * 10 + *(++ptr) - '0';
527    
528        if (c < 0)
529          {
530          *errorcodeptr = ERR61;
531          break;
532          }
533    
534      if (c == 0 || (braced && *(++ptr) != '}'))      if (c == 0 || (braced && *(++ptr) != '}'))
535        {        {
536        *errorcodeptr = ERR57;        *errorcodeptr = ERR57;
537        return 0;        break;
538        }        }
539    
540      if (negated)      if (negated)
# Line 484  else Line 542  else
542        if (c > bracount)        if (c > bracount)
543          {          {
544          *errorcodeptr = ERR15;          *errorcodeptr = ERR15;
545          return 0;          break;
546          }          }
547        c = bracount - (c - 1);        c = bracount - (c - 1);
548        }        }
# Line 513  else Line 571  else
571        c -= '0';        c -= '0';
572        while ((digitab[ptr[1]] & ctype_digit) != 0)        while ((digitab[ptr[1]] & ctype_digit) != 0)
573          c = c * 10 + *(++ptr) - '0';          c = c * 10 + *(++ptr) - '0';
574          if (c < 0)
575            {
576            *errorcodeptr = ERR61;
577            break;
578            }
579        if (c < 10 || c <= bracount)        if (c < 10 || c <= bracount)
580          {          {
581          c = -(ESC_REF + c);          c = -(ESC_REF + c);
# Line 608  else Line 671  else
671      if (c == 0)      if (c == 0)
672        {        {
673        *errorcodeptr = ERR2;        *errorcodeptr = ERR2;
674        return 0;        break;
675        }        }
676    
677  #ifndef EBCDIC  /* ASCII coding */  #ifndef EBCDIC  /* ASCII coding */
# Line 684  if (c == '{') Line 747  if (c == '{')
747      *negptr = TRUE;      *negptr = TRUE;
748      ptr++;      ptr++;
749      }      }
750    for (i = 0; i < sizeof(name) - 1; i++)    for (i = 0; i < (int)sizeof(name) - 1; i++)
751      {      {
752      c = *(++ptr);      c = *(++ptr);
753      if (c == 0) goto ERROR_RETURN;      if (c == 0) goto ERROR_RETURN;
# Line 887  for (; *ptr != 0; ptr++) Line 950  for (; *ptr != 0; ptr++)
950      {      {
951      while (*(++ptr) != ']')      while (*(++ptr) != ']')
952        {        {
953          if (*ptr == 0) return -1;
954        if (*ptr == '\\')        if (*ptr == '\\')
955          {          {
956          if (*(++ptr) == 0) return -1;          if (*(++ptr) == 0) return -1;
# Line 914  for (; *ptr != 0; ptr++) Line 978  for (; *ptr != 0; ptr++)
978    /* An opening parens must now be a real metacharacter */    /* An opening parens must now be a real metacharacter */
979    
980    if (*ptr != '(') continue;    if (*ptr != '(') continue;
981    if (ptr[1] != '?')    if (ptr[1] != '?' && ptr[1] != '*')
982      {      {
983      count++;      count++;
984      if (name == NULL && count == lorn) return count;      if (name == NULL && count == lorn) return count;
# Line 1042  for (;;) Line 1106  for (;;)
1106    {    {
1107    int d;    int d;
1108    register int op = *cc;    register int op = *cc;
   
1109    switch (op)    switch (op)
1110      {      {
1111      case OP_CBRA:      case OP_CBRA:
# Line 1131  for (;;) Line 1194  for (;;)
1194    
1195      case OP_TYPEEXACT:      case OP_TYPEEXACT:
1196      branchlength += GET2(cc,1);      branchlength += GET2(cc,1);
1197        if (cc[3] == OP_PROP || cc[3] == OP_NOTPROP) cc += 2;
1198      cc += 4;      cc += 4;
1199      break;      break;
1200    
# Line 1239  for (;;) Line 1303  for (;;)
1303      code += _pcre_OP_lengths[c];      code += _pcre_OP_lengths[c];
1304      }      }
1305    
1306    /* In UTF-8 mode, opcodes that are followed by a character may be followed by    /* Otherwise, we can get the item's length from the table, except that for
1307    a multi-byte character. The length in the table is a minimum, so we have to    repeated character types, we have to test for \p and \P, which have an extra
1308    arrange to skip the extra bytes. */    two bytes of parameters. */
1309    
1310    else    else
1311      {      {
1312        switch(c)
1313          {
1314          case OP_TYPESTAR:
1315          case OP_TYPEMINSTAR:
1316          case OP_TYPEPLUS:
1317          case OP_TYPEMINPLUS:
1318          case OP_TYPEQUERY:
1319          case OP_TYPEMINQUERY:
1320          case OP_TYPEUPTO:
1321          case OP_TYPEMINUPTO:
1322          case OP_TYPEEXACT:
1323          case OP_TYPEPOSSTAR:
1324          case OP_TYPEPOSPLUS:
1325          case OP_TYPEPOSQUERY:
1326          case OP_TYPEPOSUPTO:
1327          if (code[1] == OP_PROP || code[1] == OP_NOTPROP) code += 2;
1328          break;
1329          }
1330    
1331        /* Add in the fixed length from the table */
1332    
1333      code += _pcre_OP_lengths[c];      code += _pcre_OP_lengths[c];
1334    
1335      /* In UTF-8 mode, opcodes that are followed by a character may be followed by
1336      a multi-byte character. The length in the table is a minimum, so we have to
1337      arrange to skip the extra bytes. */
1338    
1339  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
1340      if (utf8) switch(c)      if (utf8) switch(c)
1341        {        {
# Line 1267  for (;;) Line 1357  for (;;)
1357        if (code[-1] >= 0xc0) code += _pcre_utf8_table4[code[-1] & 0x3f];        if (code[-1] >= 0xc0) code += _pcre_utf8_table4[code[-1] & 0x3f];
1358        break;        break;
1359        }        }
1360  #endif  #endif
1361      }      }
1362    }    }
1363  }  }
# Line 1296  for (;;) Line 1386  for (;;)
1386    register int c = *code;    register int c = *code;
1387    if (c == OP_END) return NULL;    if (c == OP_END) return NULL;
1388    if (c == OP_RECURSE) return code;    if (c == OP_RECURSE) return code;
1389    
1390    /* XCLASS is used for classes that cannot be represented just by a bit    /* XCLASS is used for classes that cannot be represented just by a bit
1391    map. This includes negated single high-valued characters. The length in    map. This includes negated single high-valued characters. The length in
1392    the table is zero; the actual length is stored in the compiled code. */    the table is zero; the actual length is stored in the compiled code. */
1393    
1394    if (c == OP_XCLASS) code += GET(code, 1);    if (c == OP_XCLASS) code += GET(code, 1);
1395    
1396    /* Otherwise, we get the item's length from the table. In UTF-8 mode, opcodes    /* Otherwise, we can get the item's length from the table, except that for
1397    that are followed by a character may be followed by a multi-byte character.    repeated character types, we have to test for \p and \P, which have an extra
1398    The length in the table is a minimum, so we have to arrange to skip the extra    two bytes of parameters. */
   bytes. */  
1399    
1400    else    else
1401      {      {
1402        switch(c)
1403          {
1404          case OP_TYPESTAR:
1405          case OP_TYPEMINSTAR:
1406          case OP_TYPEPLUS:
1407          case OP_TYPEMINPLUS:
1408          case OP_TYPEQUERY:
1409          case OP_TYPEMINQUERY:
1410          case OP_TYPEUPTO:
1411          case OP_TYPEMINUPTO:
1412          case OP_TYPEEXACT:
1413          case OP_TYPEPOSSTAR:
1414          case OP_TYPEPOSPLUS:
1415          case OP_TYPEPOSQUERY:
1416          case OP_TYPEPOSUPTO:
1417          if (code[1] == OP_PROP || code[1] == OP_NOTPROP) code += 2;
1418          break;
1419          }
1420    
1421        /* Add in the fixed length from the table */
1422    
1423      code += _pcre_OP_lengths[c];      code += _pcre_OP_lengths[c];
1424    
1425        /* In UTF-8 mode, opcodes that are followed by a character may be followed
1426        by a multi-byte character. The length in the table is a minimum, so we have
1427        to arrange to skip the extra bytes. */
1428    
1429  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
1430      if (utf8) switch(c)      if (utf8) switch(c)
1431        {        {
# Line 1332  for (;;) Line 1447  for (;;)
1447        if (code[-1] >= 0xc0) code += _pcre_utf8_table4[code[-1] & 0x3f];        if (code[-1] >= 0xc0) code += _pcre_utf8_table4[code[-1] & 0x3f];
1448        break;        break;
1449        }        }
1450  #endif  #endif
1451      }      }
1452    }    }
1453  }  }
# Line 1370  for (code = first_significant_code(code Line 1485  for (code = first_significant_code(code
1485    
1486    c = *code;    c = *code;
1487    
1488    if (c == OP_BRA || c == OP_CBRA || c == OP_ONCE)    /* Groups with zero repeats can of course be empty; skip them. */
1489    
1490      if (c == OP_BRAZERO || c == OP_BRAMINZERO)
1491        {
1492        code += _pcre_OP_lengths[c];
1493        do code += GET(code, 1); while (*code == OP_ALT);
1494        c = *code;
1495        continue;
1496        }
1497    
1498      /* For other groups, scan the branches. */
1499    
1500      if (c == OP_BRA || c == OP_CBRA || c == OP_ONCE || c == OP_COND)
1501      {      {
1502      BOOL empty_branch;      BOOL empty_branch;
1503      if (GET(code, 1) == 0) return TRUE;    /* Hit unclosed bracket */      if (GET(code, 1) == 0) return TRUE;    /* Hit unclosed bracket */
# Line 1386  for (code = first_significant_code(code Line 1513  for (code = first_significant_code(code
1513        }        }
1514      while (*code == OP_ALT);      while (*code == OP_ALT);
1515      if (!empty_branch) return FALSE;   /* All branches are non-empty */      if (!empty_branch) return FALSE;   /* All branches are non-empty */
1516        c = *code;
     /* Move past the KET and fudge things so that the increment in the "for"  
     above has no effect. */  
   
     c = OP_END;  
     code += 1 + LINK_SIZE - _pcre_OP_lengths[c];  
1517      continue;      continue;
1518      }      }
1519    
# Line 1399  for (code = first_significant_code(code Line 1521  for (code = first_significant_code(code
1521    
1522    switch (c)    switch (c)
1523      {      {
1524      /* Check for quantifiers after a class */      /* Check for quantifiers after a class. XCLASS is used for classes that
1525        cannot be represented just by a bit map. This includes negated single
1526        high-valued characters. The length in _pcre_OP_lengths[] is zero; the
1527        actual length is stored in the compiled code, so we must update "code"
1528        here. */
1529    
1530  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
1531      case OP_XCLASS:      case OP_XCLASS:
1532      ccode = code + GET(code, 1);      ccode = code += GET(code, 1);
1533      goto CHECK_CLASS_REPEAT;      goto CHECK_CLASS_REPEAT;
1534  #endif  #endif
1535    
# Line 1925  if (next >= 0) switch(op_code) Line 2051  if (next >= 0) switch(op_code)
2051    case OP_NOT_WORDCHAR:    case OP_NOT_WORDCHAR:
2052    return next <= 127 && (cd->ctypes[next] & ctype_word) != 0;    return next <= 127 && (cd->ctypes[next] & ctype_word) != 0;
2053    
2054      case OP_HSPACE:
2055      case OP_NOT_HSPACE:
2056      switch(next)
2057        {
2058        case 0x09:
2059        case 0x20:
2060        case 0xa0:
2061        case 0x1680:
2062        case 0x180e:
2063        case 0x2000:
2064        case 0x2001:
2065        case 0x2002:
2066        case 0x2003:
2067        case 0x2004:
2068        case 0x2005:
2069        case 0x2006:
2070        case 0x2007:
2071        case 0x2008:
2072        case 0x2009:
2073        case 0x200A:
2074        case 0x202f:
2075        case 0x205f:
2076        case 0x3000:
2077        return op_code != OP_HSPACE;
2078        default:
2079        return op_code == OP_HSPACE;
2080        }
2081    
2082      case OP_VSPACE:
2083      case OP_NOT_VSPACE:
2084      switch(next)
2085        {
2086        case 0x0a:
2087        case 0x0b:
2088        case 0x0c:
2089        case 0x0d:
2090        case 0x85:
2091        case 0x2028:
2092        case 0x2029:
2093        return op_code != OP_VSPACE;
2094        default:
2095        return op_code == OP_VSPACE;
2096        }
2097    
2098    default:    default:
2099    return FALSE;    return FALSE;
2100    }    }
# Line 1959  switch(op_code) Line 2129  switch(op_code)
2129      case ESC_W:      case ESC_W:
2130      return item <= 127 && (cd->ctypes[item] & ctype_word) != 0;      return item <= 127 && (cd->ctypes[item] & ctype_word) != 0;
2131    
2132        case ESC_h:
2133        case ESC_H:
2134        switch(item)
2135          {
2136          case 0x09:
2137          case 0x20:
2138          case 0xa0:
2139          case 0x1680:
2140          case 0x180e:
2141          case 0x2000:
2142          case 0x2001:
2143          case 0x2002:
2144          case 0x2003:
2145          case 0x2004:
2146          case 0x2005:
2147          case 0x2006:
2148          case 0x2007:
2149          case 0x2008:
2150          case 0x2009:
2151          case 0x200A:
2152          case 0x202f:
2153          case 0x205f:
2154          case 0x3000:
2155          return -next != ESC_h;
2156          default:
2157          return -next == ESC_h;
2158          }
2159    
2160        case ESC_v:
2161        case ESC_V:
2162        switch(item)
2163          {
2164          case 0x0a:
2165          case 0x0b:
2166          case 0x0c:
2167          case 0x0d:
2168          case 0x85:
2169          case 0x2028:
2170          case 0x2029:
2171          return -next != ESC_v;
2172          default:
2173          return -next == ESC_v;
2174          }
2175    
2176      default:      default:
2177      return FALSE;      return FALSE;
2178      }      }
2179    
2180    case OP_DIGIT:    case OP_DIGIT:
2181    return next == -ESC_D || next == -ESC_s || next == -ESC_W;    return next == -ESC_D || next == -ESC_s || next == -ESC_W ||
2182             next == -ESC_h || next == -ESC_v;
2183    
2184    case OP_NOT_DIGIT:    case OP_NOT_DIGIT:
2185    return next == -ESC_d;    return next == -ESC_d;
# Line 1973  switch(op_code) Line 2188  switch(op_code)
2188    return next == -ESC_S || next == -ESC_d || next == -ESC_w;    return next == -ESC_S || next == -ESC_d || next == -ESC_w;
2189    
2190    case OP_NOT_WHITESPACE:    case OP_NOT_WHITESPACE:
2191    return next == -ESC_s;    return next == -ESC_s || next == -ESC_h || next == -ESC_v;
2192    
2193      case OP_HSPACE:
2194      return next == -ESC_S || next == -ESC_H || next == -ESC_d || next == -ESC_w;
2195    
2196      case OP_NOT_HSPACE:
2197      return next == -ESC_h;
2198    
2199      /* Can't have \S in here because VT matches \S (Perl anomaly) */
2200      case OP_VSPACE:
2201      return next == -ESC_V || next == -ESC_d || next == -ESC_w;
2202    
2203      case OP_NOT_VSPACE:
2204      return next == -ESC_v;
2205    
2206    case OP_WORDCHAR:    case OP_WORDCHAR:
2207    return next == -ESC_W || next == -ESC_s;    return next == -ESC_W || next == -ESC_s || next == -ESC_h || next == -ESC_v;
2208    
2209    case OP_NOT_WORDCHAR:    case OP_NOT_WORDCHAR:
2210    return next == -ESC_w || next == -ESC_d;    return next == -ESC_w || next == -ESC_d;
# Line 2091  for (;; ptr++) Line 2319  for (;; ptr++)
2319    BOOL possessive_quantifier;    BOOL possessive_quantifier;
2320    BOOL is_quantifier;    BOOL is_quantifier;
2321    BOOL is_recurse;    BOOL is_recurse;
2322      BOOL reset_bracount;
2323    int class_charcount;    int class_charcount;
2324    int class_lastchar;    int class_lastchar;
2325    int newoptions;    int newoptions;
2326    int recno;    int recno;
2327      int refsign;
2328    int skipbytes;    int skipbytes;
2329    int subreqbyte;    int subreqbyte;
2330    int subfirstbyte;    int subfirstbyte;
# Line 2127  for (;; ptr++) Line 2357  for (;; ptr++)
2357      */      */
2358    
2359      if (code < last_code) code = last_code;      if (code < last_code) code = last_code;
2360    
2361        /* Paranoid check for integer overflow */
2362    
2363        if (OFLOW_MAX - *lengthptr < code - last_code)
2364          {
2365          *errorcodeptr = ERR20;
2366          goto FAILED;
2367          }
2368    
2369      *lengthptr += code - last_code;      *lengthptr += code - last_code;
2370      DPRINTF(("length=%d added %d c=%c\n", *lengthptr, code - last_code, c));      DPRINTF(("length=%d added %d c=%c\n", *lengthptr, code - last_code, c));
2371    
# Line 2239  for (;; ptr++) Line 2478  for (;; ptr++)
2478      *ptrptr = ptr;      *ptrptr = ptr;
2479      if (lengthptr != NULL)      if (lengthptr != NULL)
2480        {        {
2481          if (OFLOW_MAX - *lengthptr < code - last_code)
2482            {
2483            *errorcodeptr = ERR20;
2484            goto FAILED;
2485            }
2486        *lengthptr += code - last_code;   /* To include callout length */        *lengthptr += code - last_code;   /* To include callout length */
2487        DPRINTF((">> end branch\n"));        DPRINTF((">> end branch\n"));
2488        }        }
# Line 2301  for (;; ptr++) Line 2545  for (;; ptr++)
2545        goto FAILED;        goto FAILED;
2546        }        }
2547    
2548      /* If the first character is '^', set the negation flag and skip it. */      /* If the first character is '^', set the negation flag and skip it. Also,
2549        if the first few characters (either before or after ^) are \Q\E or \E we
2550        skip them too. This makes for compatibility with Perl. */
2551    
2552      if ((c = *(++ptr)) == '^')      negate_class = FALSE;
2553        for (;;)
2554        {        {
       negate_class = TRUE;  
2555        c = *(++ptr);        c = *(++ptr);
2556        }        if (c == '\\')
2557      else          {
2558        {          if (ptr[1] == 'E') ptr++;
2559        negate_class = FALSE;            else if (strncmp((const char *)ptr+1, "Q\\E", 3) == 0) ptr += 3;
2560                else break;
2561            }
2562          else if (!negate_class && c == '^')
2563            negate_class = TRUE;
2564          else break;
2565        }        }
2566    
2567      /* Keep a count of chars with values < 256 so that we can optimize the case      /* Keep a count of chars with values < 256 so that we can optimize the case
# Line 2451  for (;; ptr++) Line 2702  for (;; ptr++)
2702        of the specials, which just set a flag. The sequence \b is a special        of the specials, which just set a flag. The sequence \b is a special
2703        case. Inside a class (and only there) it is treated as backspace.        case. Inside a class (and only there) it is treated as backspace.
2704        Elsewhere it marks a word boundary. Other escapes have preset maps ready        Elsewhere it marks a word boundary. Other escapes have preset maps ready
2705        to or into the one we are building. We assume they have more than one        to 'or' into the one we are building. We assume they have more than one
2706        character in them, so set class_charcount bigger than one. */        character in them, so set class_charcount bigger than one. */
2707    
2708        if (c == '\\')        if (c == '\\')
# Line 2471  for (;; ptr++) Line 2722  for (;; ptr++)
2722            else inescq = TRUE;            else inescq = TRUE;
2723            continue;            continue;
2724            }            }
2725            else if (-c == ESC_E) continue;  /* Ignore orphan \E */
2726    
2727          if (c < 0)          if (c < 0)
2728            {            {
# Line 2519  for (;; ptr++) Line 2771  for (;; ptr++)
2771            else if (c == -ESC_d || c == -ESC_D || c == -ESC_w ||            else if (c == -ESC_d || c == -ESC_D || c == -ESC_w ||
2772                     c == -ESC_W || c == -ESC_s || c == -ESC_S) continue;                     c == -ESC_W || c == -ESC_s || c == -ESC_S) continue;
2773    
2774              /* We need to deal with \H, \h, \V, and \v in both phases because
2775              they use extra memory. */
2776    
2777              if (-c == ESC_h)
2778                {
2779                SETBIT(classbits, 0x09); /* VT */
2780                SETBIT(classbits, 0x20); /* SPACE */
2781                SETBIT(classbits, 0xa0); /* NSBP */
2782    #ifdef SUPPORT_UTF8
2783                if (utf8)
2784                  {
2785                  class_utf8 = TRUE;
2786                  *class_utf8data++ = XCL_SINGLE;
2787                  class_utf8data += _pcre_ord2utf8(0x1680, class_utf8data);
2788                  *class_utf8data++ = XCL_SINGLE;
2789                  class_utf8data += _pcre_ord2utf8(0x180e, class_utf8data);
2790                  *class_utf8data++ = XCL_RANGE;
2791                  class_utf8data += _pcre_ord2utf8(0x2000, class_utf8data);
2792                  class_utf8data += _pcre_ord2utf8(0x200A, class_utf8data);
2793                  *class_utf8data++ = XCL_SINGLE;
2794                  class_utf8data += _pcre_ord2utf8(0x202f, class_utf8data);
2795                  *class_utf8data++ = XCL_SINGLE;
2796                  class_utf8data += _pcre_ord2utf8(0x205f, class_utf8data);
2797                  *class_utf8data++ = XCL_SINGLE;
2798                  class_utf8data += _pcre_ord2utf8(0x3000, class_utf8data);
2799                  }
2800    #endif
2801                continue;
2802                }
2803    
2804              if (-c == ESC_H)
2805                {
2806                for (c = 0; c < 32; c++)
2807                  {
2808                  int x = 0xff;
2809                  switch (c)
2810                    {
2811                    case 0x09/8: x ^= 1 << (0x09%8); break;
2812                    case 0x20/8: x ^= 1 << (0x20%8); break;
2813                    case 0xa0/8: x ^= 1 << (0xa0%8); break;
2814                    default: break;
2815                    }
2816                  classbits[c] |= x;
2817                  }
2818    
2819    #ifdef SUPPORT_UTF8
2820                if (utf8)
2821                  {
2822                  class_utf8 = TRUE;
2823                  *class_utf8data++ = XCL_RANGE;
2824                  class_utf8data += _pcre_ord2utf8(0x0100, class_utf8data);
2825                  class_utf8data += _pcre_ord2utf8(0x167f, class_utf8data);
2826                  *class_utf8data++ = XCL_RANGE;
2827                  class_utf8data += _pcre_ord2utf8(0x1681, class_utf8data);
2828                  class_utf8data += _pcre_ord2utf8(0x180d, class_utf8data);
2829                  *class_utf8data++ = XCL_RANGE;
2830                  class_utf8data += _pcre_ord2utf8(0x180f, class_utf8data);
2831                  class_utf8data += _pcre_ord2utf8(0x1fff, class_utf8data);
2832                  *class_utf8data++ = XCL_RANGE;
2833                  class_utf8data += _pcre_ord2utf8(0x200B, class_utf8data);
2834                  class_utf8data += _pcre_ord2utf8(0x202e, class_utf8data);
2835                  *class_utf8data++ = XCL_RANGE;
2836                  class_utf8data += _pcre_ord2utf8(0x2030, class_utf8data);
2837                  class_utf8data += _pcre_ord2utf8(0x205e, class_utf8data);
2838                  *class_utf8data++ = XCL_RANGE;
2839                  class_utf8data += _pcre_ord2utf8(0x2060, class_utf8data);
2840                  class_utf8data += _pcre_ord2utf8(0x2fff, class_utf8data);
2841                  *class_utf8data++ = XCL_RANGE;
2842                  class_utf8data += _pcre_ord2utf8(0x3001, class_utf8data);
2843                  class_utf8data += _pcre_ord2utf8(0x7fffffff, class_utf8data);
2844                  }
2845    #endif
2846                continue;
2847                }
2848    
2849              if (-c == ESC_v)
2850                {
2851                SETBIT(classbits, 0x0a); /* LF */
2852                SETBIT(classbits, 0x0b); /* VT */
2853                SETBIT(classbits, 0x0c); /* FF */
2854                SETBIT(classbits, 0x0d); /* CR */
2855                SETBIT(classbits, 0x85); /* NEL */
2856    #ifdef SUPPORT_UTF8
2857                if (utf8)
2858                  {
2859                  class_utf8 = TRUE;
2860                  *class_utf8data++ = XCL_RANGE;
2861                  class_utf8data += _pcre_ord2utf8(0x2028, class_utf8data);
2862                  class_utf8data += _pcre_ord2utf8(0x2029, class_utf8data);
2863                  }
2864    #endif
2865                continue;
2866                }
2867    
2868              if (-c == ESC_V)
2869                {
2870                for (c = 0; c < 32; c++)
2871                  {
2872                  int x = 0xff;
2873                  switch (c)
2874                    {
2875                    case 0x0a/8: x ^= 1 << (0x0a%8);
2876                                 x ^= 1 << (0x0b%8);
2877                                 x ^= 1 << (0x0c%8);
2878                                 x ^= 1 << (0x0d%8);
2879                                 break;
2880                    case 0x85/8: x ^= 1 << (0x85%8); break;
2881                    default: break;
2882                    }
2883                  classbits[c] |= x;
2884                  }
2885    
2886    #ifdef SUPPORT_UTF8
2887                if (utf8)
2888                  {
2889                  class_utf8 = TRUE;
2890                  *class_utf8data++ = XCL_RANGE;
2891                  class_utf8data += _pcre_ord2utf8(0x0100, class_utf8data);
2892                  class_utf8data += _pcre_ord2utf8(0x2027, class_utf8data);
2893                  *class_utf8data++ = XCL_RANGE;
2894                  class_utf8data += _pcre_ord2utf8(0x2029, class_utf8data);
2895                  class_utf8data += _pcre_ord2utf8(0x7fffffff, class_utf8data);
2896                  }
2897    #endif
2898                continue;
2899                }
2900    
2901            /* We need to deal with \P and \p in both phases. */            /* We need to deal with \P and \p in both phases. */
2902    
2903  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
# Line 2659  for (;; ptr++) Line 3038  for (;; ptr++)
3038              unsigned int origd = d;              unsigned int origd = d;
3039              while (get_othercase_range(&cc, origd, &occ, &ocd))              while (get_othercase_range(&cc, origd, &occ, &ocd))
3040                {                {
3041                if (occ >= c && ocd <= d) continue;  /* Skip embedded ranges */                if (occ >= (unsigned int)c &&
3042                      ocd <= (unsigned int)d)
3043                    continue;                          /* Skip embedded ranges */
3044    
3045                if (occ < c  && ocd >= c - 1)        /* Extend the basic range */                if (occ < (unsigned int)c  &&
3046                      ocd >= (unsigned int)c - 1)      /* Extend the basic range */
3047                  {                                  /* if there is overlap,   */                  {                                  /* if there is overlap,   */
3048                  c = occ;                           /* noting that if occ < c */                  c = occ;                           /* noting that if occ < c */
3049                  continue;                          /* we can't have ocd > d  */                  continue;                          /* we can't have ocd > d  */
3050                  }                                  /* because a subrange is  */                  }                                  /* because a subrange is  */
3051                if (ocd > d && occ <= d + 1)         /* always shorter than    */                if (ocd > (unsigned int)d &&
3052                      occ <= (unsigned int)d + 1)      /* always shorter than    */
3053                  {                                  /* the basic range.       */                  {                                  /* the basic range.       */
3054                  d = ocd;                  d = ocd;
3055                  continue;                  continue;
# Line 3262  for (;; ptr++) Line 3645  for (;; ptr++)
3645          goto FAILED;          goto FAILED;
3646          }          }
3647    
       /* This is a paranoid check to stop integer overflow later on */  
   
       if (len > MAX_DUPLENGTH)  
         {  
         *errorcodeptr = ERR50;  
         goto FAILED;  
         }  
   
3648        /* If the maximum repeat count is unlimited, find the end of the bracket        /* If the maximum repeat count is unlimited, find the end of the bracket
3649        by scanning through from the start, and compute the offset back to it        by scanning through from the start, and compute the offset back to it
3650        from the current code pointer. There may be an OP_OPT setting following        from the current code pointer. There may be an OP_OPT setting following
# Line 3358  for (;; ptr++) Line 3733  for (;; ptr++)
3733          if (repeat_min > 1)          if (repeat_min > 1)
3734            {            {
3735            /* In the pre-compile phase, we don't actually do the replication. We            /* In the pre-compile phase, we don't actually do the replication. We
3736            just adjust the length as if we had. */            just adjust the length as if we had. Do some paranoid checks for
3737              potential integer overflow. */
3738    
3739            if (lengthptr != NULL)            if (lengthptr != NULL)
3740              *lengthptr += (repeat_min - 1)*length_prevgroup;              {
3741                int delta = (repeat_min - 1)*length_prevgroup;
3742                if ((double)(repeat_min - 1)*(double)length_prevgroup >
3743                                                                (double)INT_MAX ||
3744                    OFLOW_MAX - *lengthptr < delta)
3745                  {
3746                  *errorcodeptr = ERR20;
3747                  goto FAILED;
3748                  }
3749                *lengthptr += delta;
3750                }
3751    
3752            /* This is compiling for real */            /* This is compiling for real */
3753    
# Line 3399  for (;; ptr++) Line 3785  for (;; ptr++)
3785          /* In the pre-compile phase, we don't actually do the replication. We          /* In the pre-compile phase, we don't actually do the replication. We
3786          just adjust the length as if we had. For each repetition we must add 1          just adjust the length as if we had. For each repetition we must add 1
3787          to the length for BRAZERO and for all but the last repetition we must          to the length for BRAZERO and for all but the last repetition we must
3788          add 2 + 2*LINKSIZE to allow for the nesting that occurs. */          add 2 + 2*LINKSIZE to allow for the nesting that occurs. Do some
3789            paranoid checks to avoid integer overflow. */
3790    
3791          if (lengthptr != NULL && repeat_max > 0)          if (lengthptr != NULL && repeat_max > 0)
3792            *lengthptr += repeat_max * (length_prevgroup + 1 + 2 + 2*LINK_SIZE) -            {
3793              2 - 2*LINK_SIZE;  /* Last one doesn't nest */            int delta = repeat_max * (length_prevgroup + 1 + 2 + 2*LINK_SIZE) -
3794                          2 - 2*LINK_SIZE;   /* Last one doesn't nest */
3795              if ((double)repeat_max *
3796                    (double)(length_prevgroup + 1 + 2 + 2*LINK_SIZE)
3797                      > (double)INT_MAX ||
3798                  OFLOW_MAX - *lengthptr < delta)
3799                {
3800                *errorcodeptr = ERR20;
3801                goto FAILED;
3802                }
3803              *lengthptr += delta;
3804              }
3805    
3806          /* This is compiling for real */          /* This is compiling for real */
3807    
# Line 3555  for (;; ptr++) Line 3953  for (;; ptr++)
3953      /* ===================================================================*/      /* ===================================================================*/
3954      /* Start of nested parenthesized sub-expression, or comment or lookahead or      /* Start of nested parenthesized sub-expression, or comment or lookahead or
3955      lookbehind or option setting or condition or all the other extended      lookbehind or option setting or condition or all the other extended
3956      parenthesis forms. First deal with the specials; all are introduced by ?,      parenthesis forms.  */
     and the appearance of any of them means that this is not a capturing  
     group. */  
3957    
3958      case '(':      case '(':
3959      newoptions = options;      newoptions = options;
3960      skipbytes = 0;      skipbytes = 0;
3961      bravalue = OP_CBRA;      bravalue = OP_CBRA;
3962      save_hwm = cd->hwm;      save_hwm = cd->hwm;
3963        reset_bracount = FALSE;
3964    
3965      if (*(++ptr) == '?')      /* First deal with various "verbs" that can be introduced by '*'. */
3966    
3967        if (*(++ptr) == '*' && (cd->ctypes[ptr[1]] & ctype_letter) != 0)
3968          {
3969          int i, namelen;
3970          const uschar *name = ++ptr;
3971          previous = NULL;
3972          while ((cd->ctypes[*++ptr] & ctype_letter) != 0);
3973          if (*ptr == ':')
3974            {
3975            *errorcodeptr = ERR59;   /* Not supported */
3976            goto FAILED;
3977            }
3978          if (*ptr != ')')
3979            {
3980            *errorcodeptr = ERR60;
3981            goto FAILED;
3982            }
3983          namelen = ptr - name;
3984          for (i = 0; i < verbcount; i++)
3985            {
3986            if (namelen == verbs[i].len &&
3987                strncmp((char *)name, verbs[i].name, namelen) == 0)
3988              {
3989              *code = verbs[i].op;
3990              if (*code++ == OP_ACCEPT) cd->had_accept = TRUE;
3991              break;
3992              }
3993            }
3994          if (i < verbcount) continue;
3995          *errorcodeptr = ERR60;
3996          goto FAILED;
3997          }
3998    
3999        /* Deal with the extended parentheses; all are introduced by '?', and the
4000        appearance of any of them means that this is not a capturing group. */
4001    
4002        else if (*ptr == '?')
4003        {        {
4004        int i, set, unset, namelen;        int i, set, unset, namelen;
4005        int *optset;        int *optset;
# Line 3586  for (;; ptr++) Line 4020  for (;; ptr++)
4020    
4021    
4022          /* ------------------------------------------------------------ */          /* ------------------------------------------------------------ */
4023            case '|':                 /* Reset capture count for each branch */
4024            reset_bracount = TRUE;
4025            /* Fall through */
4026    
4027            /* ------------------------------------------------------------ */
4028          case ':':                 /* Non-capturing bracket */          case ':':                 /* Non-capturing bracket */
4029          bravalue = OP_BRA;          bravalue = OP_BRA;
4030          ptr++;          ptr++;
# Line 3621  for (;; ptr++) Line 4060  for (;; ptr++)
4060    
4061          code[1+LINK_SIZE] = OP_CREF;          code[1+LINK_SIZE] = OP_CREF;
4062          skipbytes = 3;          skipbytes = 3;
4063            refsign = -1;
4064    
4065          /* Check for a test for recursion in a named group. */          /* Check for a test for recursion in a named group. */
4066    
# Line 3644  for (;; ptr++) Line 4084  for (;; ptr++)
4084            terminator = '\'';            terminator = '\'';
4085            ptr++;            ptr++;
4086            }            }
4087          else terminator = 0;          else
4088              {
4089              terminator = 0;
4090              if (ptr[1] == '-' || ptr[1] == '+') refsign = *(++ptr);
4091              }
4092    
4093          /* We now expect to read a name; any thing else is an error */          /* We now expect to read a name; any thing else is an error */
4094    
# Line 3680  for (;; ptr++) Line 4124  for (;; ptr++)
4124          if (lengthptr != NULL) break;          if (lengthptr != NULL) break;
4125    
4126          /* In the real compile we do the work of looking for the actual          /* In the real compile we do the work of looking for the actual
4127          reference. */          reference. If the string started with "+" or "-" we require the rest to
4128            be digits, in which case recno will be set. */
4129    
4130            if (refsign > 0)
4131              {
4132              if (recno <= 0)
4133                {
4134                *errorcodeptr = ERR58;
4135                goto FAILED;
4136                }
4137              if (refsign == '-')
4138                {
4139                recno = cd->bracount - recno + 1;
4140                if (recno <= 0)
4141                  {
4142                  *errorcodeptr = ERR15;
4143                  goto FAILED;
4144                  }
4145                }
4146              else recno += cd->bracount;
4147              PUT2(code, 2+LINK_SIZE, recno);
4148              break;
4149              }
4150    
4151            /* Otherwise (did not start with "+" or "-"), start by looking for the
4152            name. */
4153    
4154          slot = cd->name_table;          slot = cd->name_table;
4155          for (i = 0; i < cd->names_found; i++)          for (i = 0; i < cd->names_found; i++)
# Line 3772  for (;; ptr++) Line 4241  for (;; ptr++)
4241    
4242          /* ------------------------------------------------------------ */          /* ------------------------------------------------------------ */
4243          case '!':                 /* Negative lookahead */          case '!':                 /* Negative lookahead */
         bravalue = OP_ASSERT_NOT;  
4244          ptr++;          ptr++;
4245            if (*ptr == ')')          /* Optimize (?!) */
4246              {
4247              *code++ = OP_FAIL;
4248              previous = NULL;
4249              continue;
4250              }
4251            bravalue = OP_ASSERT_NOT;
4252          break;          break;
4253    
4254    
# Line 3999  for (;; ptr++) Line 4474  for (;; ptr++)
4474    
4475    
4476          /* ------------------------------------------------------------ */          /* ------------------------------------------------------------ */
4477            case '-': case '+':
4478          case '0': case '1': case '2': case '3': case '4':   /* Recursion or */          case '0': case '1': case '2': case '3': case '4':   /* Recursion or */
4479          case '5': case '6': case '7': case '8': case '9':   /* subroutine */          case '5': case '6': case '7': case '8': case '9':   /* subroutine */
4480            {            {
4481            const uschar *called;            const uschar *called;
4482    
4483              if ((refsign = *ptr) == '+') ptr++;
4484              else if (refsign == '-')
4485                {
4486                if ((digitab[ptr[1]] & ctype_digit) == 0)
4487                  goto OTHER_CHAR_AFTER_QUERY;
4488                ptr++;
4489                }
4490    
4491            recno = 0;            recno = 0;
4492            while((digitab[*ptr] & ctype_digit) != 0)            while((digitab[*ptr] & ctype_digit) != 0)
4493              recno = recno * 10 + *ptr++ - '0';              recno = recno * 10 + *ptr++ - '0';
4494    
4495            if (*ptr != ')')            if (*ptr != ')')
4496              {              {
4497              *errorcodeptr = ERR29;              *errorcodeptr = ERR29;
4498              goto FAILED;              goto FAILED;
4499              }              }
4500    
4501              if (refsign == '-')
4502                {
4503                if (recno == 0)
4504                  {
4505                  *errorcodeptr = ERR58;
4506                  goto FAILED;
4507                  }
4508                recno = cd->bracount - recno + 1;
4509                if (recno <= 0)
4510                  {
4511                  *errorcodeptr = ERR15;
4512                  goto FAILED;
4513                  }
4514                }
4515              else if (refsign == '+')
4516                {
4517                if (recno == 0)
4518                  {
4519                  *errorcodeptr = ERR58;
4520                  goto FAILED;
4521                  }
4522                recno += cd->bracount;
4523                }
4524    
4525            /* Come here from code above that handles a named recursion */            /* Come here from code above that handles a named recursion */
4526    
4527            HANDLE_RECURSION:            HANDLE_RECURSION:
# Line 4084  for (;; ptr++) Line 4594  for (;; ptr++)
4594    
4595          /* ------------------------------------------------------------ */          /* ------------------------------------------------------------ */
4596          default:              /* Other characters: check option setting */          default:              /* Other characters: check option setting */
4597            OTHER_CHAR_AFTER_QUERY:
4598          set = unset = 0;          set = unset = 0;
4599          optset = &set;          optset = &set;
4600    
# Line 4218  for (;; ptr++) Line 4729  for (;; ptr++)
4729           errorcodeptr,                 /* Where to put an error message */           errorcodeptr,                 /* Where to put an error message */
4730           (bravalue == OP_ASSERTBACK ||           (bravalue == OP_ASSERTBACK ||
4731            bravalue == OP_ASSERTBACK_NOT), /* TRUE if back assert */            bravalue == OP_ASSERTBACK_NOT), /* TRUE if back assert */
4732             reset_bracount,               /* True if (?| group */
4733           skipbytes,                    /* Skip over bracket number */           skipbytes,                    /* Skip over bracket number */
4734           &subfirstbyte,                /* For possible first char */           &subfirstbyte,                /* For possible first char */
4735           &subreqbyte,                  /* For possible last char */           &subreqbyte,                  /* For possible last char */
# Line 4234  for (;; ptr++) Line 4746  for (;; ptr++)
4746      is on the bracket. */      is on the bracket. */
4747    
4748      /* If this is a conditional bracket, check that there are no more than      /* If this is a conditional bracket, check that there are no more than
4749      two branches in the group, or just one if it's a DEFINE group. */      two branches in the group, or just one if it's a DEFINE group. We do this
4750        in the real compile phase, not in the pre-pass, where the whole group may
4751        not be available. */
4752    
4753      if (bravalue == OP_COND)      if (bravalue == OP_COND && lengthptr == NULL)
4754        {        {
4755        uschar *tc = code;        uschar *tc = code;
4756        int condcount = 0;        int condcount = 0;
# Line 4283  for (;; ptr++) Line 4797  for (;; ptr++)
4797        goto FAILED;        goto FAILED;
4798        }        }
4799    
4800      /* In the pre-compile phase, update the length by the length of the nested      /* In the pre-compile phase, update the length by the length of the group,
4801      group, less the brackets at either end. Then reduce the compiled code to      less the brackets at either end. Then reduce the compiled code to just a
4802      just the brackets so that it doesn't use much memory if it is duplicated by      set of non-capturing brackets so that it doesn't use much memory if it is
4803      a quantifier. */      duplicated by a quantifier.*/
4804    
4805      if (lengthptr != NULL)      if (lengthptr != NULL)
4806        {        {
4807          if (OFLOW_MAX - *lengthptr < length_prevgroup - 2 - 2*LINK_SIZE)
4808            {
4809            *errorcodeptr = ERR20;
4810            goto FAILED;
4811            }
4812        *lengthptr += length_prevgroup - 2 - 2*LINK_SIZE;        *lengthptr += length_prevgroup - 2 - 2*LINK_SIZE;
4813        code++;        *code++ = OP_BRA;
4814        PUTINC(code, 0, 1 + LINK_SIZE);        PUTINC(code, 0, 1 + LINK_SIZE);
4815        *code++ = OP_KET;        *code++ = OP_KET;
4816        PUTINC(code, 0, 1 + LINK_SIZE);        PUTINC(code, 0, 1 + LINK_SIZE);
4817          break;    /* No need to waste time with special character handling */
4818        }        }
4819    
4820      /* Otherwise update the main code pointer to the end of the group. */      /* Otherwise update the main code pointer to the end of the group. */
4821    
4822      else code = tempcode;      code = tempcode;
4823    
4824      /* For a DEFINE group, required and first character settings are not      /* For a DEFINE group, required and first character settings are not
4825      relevant. */      relevant. */
# Line 4396  for (;; ptr++) Line 4916  for (;; ptr++)
4916        zerofirstbyte = firstbyte;        zerofirstbyte = firstbyte;
4917        zeroreqbyte = reqbyte;        zeroreqbyte = reqbyte;
4918    
4919        /* \k<name> or \k'name' is a back reference by name (Perl syntax) */        /* \k<name> or \k'name' is a back reference by name (Perl syntax).
4920          We also support \k{name} (.NET syntax) */
4921    
4922        if (-c == ESC_k && (ptr[1] == '<' || ptr[1] == '\''))        if (-c == ESC_k && (ptr[1] == '<' || ptr[1] == '\'' || ptr[1] == '{'))
4923          {          {
4924          is_recurse = FALSE;          is_recurse = FALSE;
4925          terminator = (*(++ptr) == '<')? '>' : '\'';          terminator = (*(++ptr) == '<')? '>' : (*ptr == '\'')? '\'' : '}';
4926          goto NAMED_REF_OR_RECURSE;          goto NAMED_REF_OR_RECURSE;
4927          }          }
4928    
# Line 4567  This function is used during the pre-com Line 5088  This function is used during the pre-com
5088  out the amount of memory needed, as well as during the real compile phase. The  out the amount of memory needed, as well as during the real compile phase. The
5089  value of lengthptr distinguishes the two phases.  value of lengthptr distinguishes the two phases.
5090    
5091  Argument:  Arguments:
5092    options        option bits, including any changes for this subpattern    options        option bits, including any changes for this subpattern
5093    oldims         previous settings of ims option bits    oldims         previous settings of ims option bits
5094    codeptr        -> the address of the current code pointer    codeptr        -> the address of the current code pointer
5095    ptrptr         -> the address of the current pattern pointer    ptrptr         -> the address of the current pattern pointer
5096    errorcodeptr   -> pointer to error code variable    errorcodeptr   -> pointer to error code variable
5097    lookbehind     TRUE if this is a lookbehind assertion    lookbehind     TRUE if this is a lookbehind assertion
5098      reset_bracount TRUE to reset the count for each branch
5099    skipbytes      skip this many bytes at start (for brackets and OP_COND)    skipbytes      skip this many bytes at start (for brackets and OP_COND)
5100    firstbyteptr   place to put the first required character, or a negative number    firstbyteptr   place to put the first required character, or a negative number
5101    reqbyteptr     place to put the last required character, or a negative number    reqbyteptr     place to put the last required character, or a negative number
# Line 4587  Returns: TRUE on success Line 5109  Returns: TRUE on success
5109    
5110  static BOOL  static BOOL
5111  compile_regex(int options, int oldims, uschar **codeptr, const uschar **ptrptr,  compile_regex(int options, int oldims, uschar **codeptr, const uschar **ptrptr,
5112    int *errorcodeptr, BOOL lookbehind, int skipbytes, int *firstbyteptr,    int *errorcodeptr, BOOL lookbehind, BOOL reset_bracount, int skipbytes,
5113    int *reqbyteptr, branch_chain *bcptr, compile_data *cd, int *lengthptr)    int *firstbyteptr, int *reqbyteptr, branch_chain *bcptr, compile_data *cd,
5114      int *lengthptr)
5115  {  {
5116  const uschar *ptr = *ptrptr;  const uschar *ptr = *ptrptr;
5117  uschar *code = *codeptr;  uschar *code = *codeptr;
# Line 4598  uschar *reverse_count = NULL; Line 5121  uschar *reverse_count = NULL;
5121  int firstbyte, reqbyte;  int firstbyte, reqbyte;
5122  int branchfirstbyte, branchreqbyte;  int branchfirstbyte, branchreqbyte;
5123  int length;  int length;
5124    int orig_bracount;
5125    int max_bracount;
5126  branch_chain bc;  branch_chain bc;
5127    
5128  bc.outer = bcptr;  bc.outer = bcptr;
# Line 4626  code += 1 + LINK_SIZE + skipbytes; Line 5151  code += 1 + LINK_SIZE + skipbytes;
5151    
5152  /* Loop for each alternative branch */  /* Loop for each alternative branch */
5153    
5154    orig_bracount = max_bracount = cd->bracount;
5155  for (;;)  for (;;)
5156    {    {
5157      /* For a (?| group, reset the capturing bracket count so that each branch
5158      uses the same numbers. */
5159    
5160      if (reset_bracount) cd->bracount = orig_bracount;
5161    
5162    /* Handle a change of ims options at the start of the branch */    /* Handle a change of ims options at the start of the branch */
5163    
5164    if ((options & PCRE_IMS) != oldims)    if ((options & PCRE_IMS) != oldims)
# Line 4657  for (;;) Line 5188  for (;;)
5188      return FALSE;      return FALSE;
5189      }      }
5190    
5191      /* Keep the highest bracket count in case (?| was used and some branch
5192      has fewer than the rest. */
5193    
5194      if (cd->bracount > max_bracount) max_bracount = cd->bracount;
5195    
5196    /* In the real compile phase, there is some post-processing to be done. */    /* In the real compile phase, there is some post-processing to be done. */
5197    
5198    if (lengthptr == NULL)    if (lengthptr == NULL)
# Line 4720  for (;;) Line 5256  for (;;)
5256        }        }
5257      }      }
5258    
5259    /* Reached end of expression, either ')' or end of pattern. Go back through    /* Reached end of expression, either ')' or end of pattern. In the real
5260    the alternative branches and reverse the chain of offsets, with the field in    compile phase, go back through the alternative branches and reverse the chain
5261    the BRA item now becoming an offset to the first alternative. If there are    of offsets, with the field in the BRA item now becoming an offset to the
5262    no alternatives, it points to the end of the group. The length in the    first alternative. If there are no alternatives, it points to the end of the
5263    terminating ket is always the length of the whole bracketed item. If any of    group. The length in the terminating ket is always the length of the whole
5264    the ims options were changed inside the group, compile a resetting op-code    bracketed item. If any of the ims options were changed inside the group,
5265    following, except at the very end of the pattern. Return leaving the pointer    compile a resetting op-code following, except at the very end of the pattern.
5266    at the terminating char. */    Return leaving the pointer at the terminating char. */
5267    
5268    if (*ptr != '|')    if (*ptr != '|')
5269      {      {
5270      int branch_length = code - last_branch;      if (lengthptr == NULL)
     do  
5271        {        {
5272        int prev_length = GET(last_branch, 1);        int branch_length = code - last_branch;
5273        PUT(last_branch, 1, branch_length);        do
5274        branch_length = prev_length;          {
5275        last_branch -= branch_length;          int prev_length = GET(last_branch, 1);
5276            PUT(last_branch, 1, branch_length);
5277            branch_length = prev_length;
5278            last_branch -= branch_length;
5279            }
5280          while (branch_length > 0);
5281        }        }
     while (branch_length > 0);  
5282    
5283      /* Fill in the ket */      /* Fill in the ket */
5284    
# Line 4756  for (;;) Line 5295  for (;;)
5295        length += 2;        length += 2;
5296        }        }
5297    
5298        /* Retain the highest bracket number, in case resetting was used. */
5299    
5300        cd->bracount = max_bracount;
5301    
5302      /* Set values to pass back */      /* Set values to pass back */
5303    
5304      *codeptr = code;      *codeptr = code;
5305      *ptrptr = ptr;      *ptrptr = ptr;
5306      *firstbyteptr = firstbyte;      *firstbyteptr = firstbyte;
5307      *reqbyteptr = reqbyte;      *reqbyteptr = reqbyte;
5308      if (lengthptr != NULL) *lengthptr += length;      if (lengthptr != NULL)
5309          {
5310          if (OFLOW_MAX - *lengthptr < length)
5311            {
5312            *errorcodeptr = ERR20;
5313            return FALSE;
5314            }
5315          *lengthptr += length;
5316          }
5317      return TRUE;      return TRUE;
5318      }      }
5319    
5320    /* Another branch follows; insert an "or" node. Its length field points back    /* Another branch follows. In the pre-compile phase, we can move the code
5321      pointer back to where it was for the start of the first branch. (That is,
5322      pretend that each branch is the only one.)
5323    
5324      In the real compile phase, insert an ALT node. Its length field points back
5325    to the previous branch while the bracket remains open. At the end the chain    to the previous branch while the bracket remains open. At the end the chain
5326    is reversed. It's done like this so that the start of the bracket has a    is reversed. It's done like this so that the start of the bracket has a
5327    zero offset until it is closed, making it possible to detect recursion. */    zero offset until it is closed, making it possible to detect recursion. */
5328    
5329    *code = OP_ALT;    if (lengthptr != NULL)
5330    PUT(code, 1, code - last_branch);      {
5331    bc.current = last_branch = code;      code = *codeptr + 1 + LINK_SIZE + skipbytes;
5332    code += 1 + LINK_SIZE;      length += 1 + LINK_SIZE;
5333        }
5334      else
5335        {
5336        *code = OP_ALT;
5337        PUT(code, 1, code - last_branch);
5338        bc.current = last_branch = code;
5339        code += 1 + LINK_SIZE;
5340        }
5341    
5342    ptr++;    ptr++;
   length += 1 + LINK_SIZE;  
5343    }    }
5344  /* Control never reaches here */  /* Control never reaches here */
5345  }  }
# Line 5043  Returns: pointer to compiled data Line 5606  Returns: pointer to compiled data
5606                  with errorptr and erroroffset set                  with errorptr and erroroffset set
5607  */  */
5608    
5609  PCRE_DATA_SCOPE pcre *  PCRE_EXP_DEFN pcre *
5610  pcre_compile(const char *pattern, int options, const char **errorptr,  pcre_compile(const char *pattern, int options, const char **errorptr,
5611    int *erroroffset, const unsigned char *tables)    int *erroroffset, const unsigned char *tables)
5612  {  {
# Line 5051  return pcre_compile2(pattern, options, N Line 5614  return pcre_compile2(pattern, options, N
5614  }  }
5615    
5616    
5617  PCRE_DATA_SCOPE pcre *  PCRE_EXP_DEFN pcre *
5618  pcre_compile2(const char *pattern, int options, int *errorcodeptr,  pcre_compile2(const char *pattern, int options, int *errorcodeptr,
5619    const char **errorptr, int *erroroffset, const unsigned char *tables)    const char **errorptr, int *erroroffset, const unsigned char *tables)
5620  {  {
# Line 5100  if (errorcodeptr != NULL) *errorcodeptr Line 5663  if (errorcodeptr != NULL) *errorcodeptr
5663  if (erroroffset == NULL)  if (erroroffset == NULL)
5664    {    {
5665    errorcode = ERR16;    errorcode = ERR16;
5666    goto PCRE_EARLY_ERROR_RETURN;    goto PCRE_EARLY_ERROR_RETURN2;
5667    }    }
5668    
5669  *erroroffset = 0;  *erroroffset = 0;
# Line 5113  if (utf8 && (options & PCRE_NO_UTF8_CHEC Line 5676  if (utf8 && (options & PCRE_NO_UTF8_CHEC
5676       (*erroroffset = _pcre_valid_utf8((uschar *)pattern, -1)) >= 0)       (*erroroffset = _pcre_valid_utf8((uschar *)pattern, -1)) >= 0)
5677    {    {
5678    errorcode = ERR44;    errorcode = ERR44;
5679    goto PCRE_UTF8_ERROR_RETURN;    goto PCRE_EARLY_ERROR_RETURN2;
5680    }    }
5681  #else  #else
5682  if ((options & PCRE_UTF8) != 0)  if ((options & PCRE_UTF8) != 0)
# Line 5138  cd->cbits = tables + cbits_offset; Line 5701  cd->cbits = tables + cbits_offset;
5701  cd->ctypes = tables + ctypes_offset;  cd->ctypes = tables + ctypes_offset;
5702    
5703  /* Handle different types of newline. The three bits give seven cases. The  /* Handle different types of newline. The three bits give seven cases. The
5704  current code allows for fixed one- or two-byte sequences, plus "any". */  current code allows for fixed one- or two-byte sequences, plus "any" and
5705    "anycrlf". */
5706    
5707  switch (options & (PCRE_NEWLINE_CRLF | PCRE_NEWLINE_ANY))  switch (options & (PCRE_NEWLINE_CRLF | PCRE_NEWLINE_ANY))
5708    {    {
# Line 5148  switch (options & (PCRE_NEWLINE_CRLF | P Line 5712  switch (options & (PCRE_NEWLINE_CRLF | P
5712    case PCRE_NEWLINE_CR+    case PCRE_NEWLINE_CR+
5713         PCRE_NEWLINE_LF: newline = ('\r' << 8) | '\n'; break;         PCRE_NEWLINE_LF: newline = ('\r' << 8) | '\n'; break;
5714    case PCRE_NEWLINE_ANY: newline = -1; break;    case PCRE_NEWLINE_ANY: newline = -1; break;
5715      case PCRE_NEWLINE_ANYCRLF: newline = -2; break;
5716    default: errorcode = ERR56; goto PCRE_EARLY_ERROR_RETURN;    default: errorcode = ERR56; goto PCRE_EARLY_ERROR_RETURN;
5717    }    }
5718    
5719  if (newline < 0)  if (newline == -2)
5720      {
5721      cd->nltype = NLTYPE_ANYCRLF;
5722      }
5723    else if (newline < 0)
5724    {    {
5725    cd->nltype = NLTYPE_ANY;    cd->nltype = NLTYPE_ANY;
5726    }    }
# Line 5212  outside can help speed up starting point Line 5781  outside can help speed up starting point
5781  code = cworkspace;  code = cworkspace;
5782  *code = OP_BRA;  *code = OP_BRA;
5783  (void)compile_regex(cd->external_options, cd->external_options & PCRE_IMS,  (void)compile_regex(cd->external_options, cd->external_options & PCRE_IMS,
5784    &code, &ptr, &errorcode, FALSE, 0, &firstbyte, &reqbyte, NULL, cd, &length);    &code, &ptr, &errorcode, FALSE, FALSE, 0, &firstbyte, &reqbyte, NULL, cd,
5785      &length);
5786  if (errorcode != 0) goto PCRE_EARLY_ERROR_RETURN;  if (errorcode != 0) goto PCRE_EARLY_ERROR_RETURN;
5787    
5788  DPRINTF(("end pre-compile: length=%d workspace=%d\n", length,  DPRINTF(("end pre-compile: length=%d workspace=%d\n", length,
# Line 5271  cd->start_code = codestart; Line 5841  cd->start_code = codestart;
5841  cd->hwm = cworkspace;  cd->hwm = cworkspace;
5842  cd->req_varyopt = 0;  cd->req_varyopt = 0;
5843  cd->nopartial = FALSE;  cd->nopartial = FALSE;
5844    cd->had_accept = FALSE;
5845    
5846  /* Set up a starting, non-extracting bracket, then compile the expression. On  /* Set up a starting, non-extracting bracket, then compile the expression. On
5847  error, errorcode will be set non-zero, so we don't need to look at the result  error, errorcode will be set non-zero, so we don't need to look at the result
# Line 5280  ptr = (const uschar *)pattern; Line 5851  ptr = (const uschar *)pattern;
5851  code = (uschar *)codestart;  code = (uschar *)codestart;
5852  *code = OP_BRA;  *code = OP_BRA;
5853  (void)compile_regex(re->options, re->options & PCRE_IMS, &code, &ptr,  (void)compile_regex(re->options, re->options & PCRE_IMS, &code, &ptr,
5854    &errorcode, FALSE, 0, &firstbyte, &reqbyte, NULL, cd, NULL);    &errorcode, FALSE, FALSE, 0, &firstbyte, &reqbyte, NULL, cd, NULL);
5855  re->top_bracket = cd->bracount;  re->top_bracket = cd->bracount;
5856  re->top_backref = cd->top_backref;  re->top_backref = cd->top_backref;
5857    
5858  if (cd->nopartial) re->options |= PCRE_NOPARTIAL;  if (cd->nopartial) re->options |= PCRE_NOPARTIAL;
5859    if (cd->had_accept) reqbyte = -1;   /* Must disable after (*ACCEPT) */
5860    
5861  /* If not reached end of pattern on success, there's an excess bracket. */  /* If not reached end of pattern on success, there's an excess bracket. */
5862    
# Line 5325  if (errorcode != 0) Line 5897  if (errorcode != 0)
5897    (pcre_free)(re);    (pcre_free)(re);
5898    PCRE_EARLY_ERROR_RETURN:    PCRE_EARLY_ERROR_RETURN:
5899    *erroroffset = ptr - (const uschar *)pattern;    *erroroffset = ptr - (const uschar *)pattern;
5900  #ifdef SUPPORT_UTF8    PCRE_EARLY_ERROR_RETURN2:
   PCRE_UTF8_ERROR_RETURN:  
 #endif  
5901    *errorptr = error_texts[errorcode];    *errorptr = error_texts[errorcode];
5902    if (errorcodeptr != NULL) *errorcodeptr = errorcode;    if (errorcodeptr != NULL) *errorcodeptr = errorcode;
5903    return NULL;    return NULL;
# Line 5417  if ((re->options & PCRE_REQCHSET) != 0) Line 5987  if ((re->options & PCRE_REQCHSET) != 0)
5987      else printf("Req char = \\x%02x%s\n", ch, caseless);      else printf("Req char = \\x%02x%s\n", ch, caseless);
5988    }    }
5989    
5990  pcre_printint(re, stdout);  pcre_printint(re, stdout, TRUE);
5991    
5992  /* This check is done here in the debugging case so that the code that  /* This check is done here in the debugging case so that the code that
5993  was compiled can be seen. */  was compiled can be seen. */

Legend:
Removed from v.107  
changed lines
  Added in v.218

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12