Ignore:
Timestamp:
Jun 5, 2006, 3:12:48 PM (19 years ago)
Author:
ggaren
Message:

Reviewed By Maciej.
Darin already reviewed this change on the branch. See <rdar://problem/4317701>.


  • Fixed <rdar://problem/4291345> PCRE overflow in Safari JavaScriptCore

No test case because there's no behavior change.


  • pcre/pcre_compile.c: (read_repeat_counts): Check for integer overflow / out of bounds
File:
1 edited

Legend:

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

    r14457 r14736  
    719719
    720720while ((DIGITAB(*p) & ctype_digit) != 0) min = min * 10 + *p++ - '0';
     721if (min < 0 || min > 65535)
     722  {
     723    *errorcodeptr = ERR5;
     724    return p;
     725  }
    721726
    722727if (*p == '}') max = min; else
     
    726731    max = 0;
    727732    while((DIGITAB(*p) & ctype_digit) != 0) max = max * 10 + *p++ - '0';
     733    if (max < 0 || max > 65535)
     734    {
     735        *errorcodeptr = ERR5;
     736        return p;
     737    }
    728738    if (max < min)
    729739      {
     
    734744  }
    735745
    736 /* Do paranoid checks, then fill in the required variables, and pass back the
    737 pointer to the terminating '}'. */
    738 
    739 if (min > 65535 || max > 65535)
    740   *errorcodeptr = ERR5;
    741 else
    742   {
    743   *minp = min;
    744   *maxp = max;
    745   }
     746/* Fill in the required variables, and pass back the pointer to the terminating '}'. */
     747*minp = min;
     748*maxp = max;
     749
    746750return p;
    747751}
Note: See TracChangeset for help on using the changeset viewer.