/[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 1462 by ph10, Mon Mar 10 16:28:54 2014 UTC revision 1472 by ph10, Mon Apr 21 16:11:50 2014 UTC
# Line 1583  read_repeat_counts(const pcre_uchar *p, Line 1583  read_repeat_counts(const pcre_uchar *p,
1583  int min = 0;  int min = 0;
1584  int max = -1;  int max = -1;
1585    
1586  /* Read the minimum value and do a paranoid check: a negative value indicates  while (IS_DIGIT(*p))
 an integer overflow. */  
   
 while (IS_DIGIT(*p)) min = min * 10 + (int)(*p++ - CHAR_0);  
 if (min < 0 || min > 65535)  
1587    {    {
1588    *errorcodeptr = ERR5;    min = min * 10 + (int)(*p++ - CHAR_0);
1589    return p;    if (min > 65535)
1590    }      {
1591        *errorcodeptr = ERR5;
1592  /* Read the maximum value if there is one, and again do a paranoid on its size.      return p;
1593  Also, max must not be less than min. */      }
1594      }
1595    
1596  if (*p == CHAR_RIGHT_CURLY_BRACKET) max = min; else  if (*p == CHAR_RIGHT_CURLY_BRACKET) max = min; else
1597    {    {
1598    if (*(++p) != CHAR_RIGHT_CURLY_BRACKET)    if (*(++p) != CHAR_RIGHT_CURLY_BRACKET)
1599      {      {
1600      max = 0;      max = 0;
1601      while(IS_DIGIT(*p)) max = max * 10 + (int)(*p++ - CHAR_0);      while(IS_DIGIT(*p))
     if (max < 0 || max > 65535)  
1602        {        {
1603        *errorcodeptr = ERR5;        max = max * 10 + (int)(*p++ - CHAR_0);
1604        return p;        if (max > 65535)
1605        }          {
1606            *errorcodeptr = ERR5;
1607            return p;
1608            }
1609          }
1610      if (max < min)      if (max < min)
1611        {        {
1612        *errorcodeptr = ERR4;        *errorcodeptr = ERR4;
# Line 1615  if (*p == CHAR_RIGHT_CURLY_BRACKET) max Line 1615  if (*p == CHAR_RIGHT_CURLY_BRACKET) max
1615      }      }
1616    }    }
1617    
 /* Fill in the required variables, and pass back the pointer to the terminating  
 '}'. */  
   
1618  *minp = min;  *minp = min;
1619  *maxp = max;  *maxp = max;
1620  return p;  return p;

Legend:
Removed from v.1462  
changed lines
  Added in v.1472

  ViewVC Help
Powered by ViewVC 1.1.5