Show
Ignore:
Timestamp:
03/27/08 23:41:17 (8 months ago)
Author:
mrowe@apple.com
Message:

2008-03-27 Darin Adler <darin@apple.com>

Reviewed by Mark Rowe.

<rdar://problem/5826236> Regular expressions with large nested repetition counts can have their
compiled length calculated incorrectly.

  • pcre/pcre_compile.cpp: (multiplyWithOverflowCheck): (calculateCompiledPatternLength): Check for overflow when dealing with nested repetition counts and bail with an error rather than returning incorrect results.

2008-03-27 Mark Rowe <mrowe@apple.com>

Reviewed by Adam Roben.

Tests for <rdar://problem/5826236> Regular expressions with large nested repetition counts can have their
compiled length calculated incorrectly.

  • fast/js/regexp-overflow-expected.txt:
  • fast/js/resources/regexp-overflow.js:
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/fast/js/regexp-overflow-expected.txt

    r28787 r31388  
    1313PASS /{([\D-\ca]]â€şÂ£Âµ+?)}|[[\B-\u00d4]√π- ]]]{0,3}/i.exec("B√π- ]]").toString() is "B√π- ]]," 
    1414PASS /|[x\B-\u00b5]/i.exec("").toString() is "" 
     15PASS new RegExp(s); threw exception SyntaxError: Invalid regular expression: regular expression too large. 
     16PASS /(([ab]){30}){3360}/ threw exception SyntaxError: Invalid regular expression: regular expression too large. 
     17PASS /(([ab]){30}){0,3360}/ threw exception SyntaxError: Invalid regular expression: regular expression too large. 
     18PASS /(([ab]){30}){10,3360}/ threw exception SyntaxError: Invalid regular expression: regular expression too large. 
     19PASS /(([ab]){0,30}){3360}/ threw exception SyntaxError: Invalid regular expression: regular expression too large. 
     20PASS /(([ab]){0,30}){0,3360}/ threw exception SyntaxError: Invalid regular expression: regular expression too large. 
     21PASS /(([ab]){0,30}){10,3360}/ threw exception SyntaxError: Invalid regular expression: regular expression too large. 
     22PASS /(([ab]){10,30}){3360}/ threw exception SyntaxError: Invalid regular expression: regular expression too large. 
     23PASS /(([ab]){10,30}){0,3360}/ threw exception SyntaxError: Invalid regular expression: regular expression too large. 
     24PASS /(([ab]){10,30}){10,3360}/ threw exception SyntaxError: Invalid regular expression: regular expression too large. 
     25PASS /(([ab]){12})(([ab]){65535}){1680}(([ab]){38}){722}([ab]){27}/ threw exception SyntaxError: Invalid regular expression: regular expression too large. 
    1526 
    1627PASS successfullyParsed is true