Changeset 41849 in webkit
- Timestamp:
- Mar 19, 2009 5:52:04 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r41846 r41849 21 21 22 22 * wtf/Platform.h: Added HAVE_RUNLOOP_TIMER for PLATFORM(MAC). 23 24 2009-03-19 Geoffrey Garen <ggaren@apple.com> 25 26 Reviewed by Oliver Hunt. 27 28 Fixed <rdar://problem/6279213> Regular expression run-time complexity 29 limit too low for long inputs (21485) 30 31 I raised PCRE's "matchLimit" (limit on backtracking) by an order of 32 magnitude. This fixes all the reported examples of timing out on legitimate 33 regular expression matches. 34 35 In my testing on a Core Duo MacBook Pro, the longest you can get stuck 36 trying to match a string is still under 1s, so this seems like a safe change. 37 38 I can think of a number of better solutions that are more complicated, 39 but this is a good improvement for now. 40 41 * pcre/pcre_exec.cpp: 23 42 24 43 2009-03-19 Geoffrey Garen <ggaren@apple.com> -
trunk/JavaScriptCore/pcre/pcre_exec.cpp
r41252 r41849 176 176 avoid spending exponential time on complex regular expressions. */ 177 177 178 static const unsigned matchLimit = 100000 ;178 static const unsigned matchLimit = 1000000; 179 179 180 180 #ifdef DEBUG -
trunk/LayoutTests/ChangeLog
r41848 r41849 1 2009-03-19 Geoffrey Garen <ggaren@apple.com> 2 3 Reviewed by Oliver Hunt. 4 5 Fixed <rdar://problem/6279213> Regular expression run-time complexity 6 limit too low for long inputs (21485) 7 8 Added a test for a complex regexp match that should succeed, and one 9 that should fail. 10 11 * fast/js/regexp-overflow-expected.txt: 12 * fast/js/resources/regexp-overflow.js: 13 1 14 2009-03-19 Mark Rowe <mrowe@apple.com> 2 15 -
trunk/LayoutTests/fast/js/regexp-overflow-expected.txt
r31388 r41849 13 13 PASS /{([\D-\ca]]„£µ+?)}|[[\B-\u00d4]√π- ]]]{0,3}/i.exec("B√π- ]]").toString() is "B√π- ]]," 14 14 PASS /|[x\B-\u00b5]/i.exec("").toString() is "" 15 PASS new RegExp(complexPattern).exec(complexInput)[0] is complexInput 16 PASS new RegExp(complexPattern + complexPattern).exec(complexInput + complexInput) is null 15 17 PASS new RegExp(s); threw exception SyntaxError: Invalid regular expression: regular expression too large. 16 18 PASS /(([ab]){30}){3360}/ threw exception SyntaxError: Invalid regular expression: regular expression too large. -
trunk/LayoutTests/fast/js/resources/regexp-overflow.js
r41842 r41849 21 21 shouldBe('/|[x\\B-\\u00b5]/i.exec("").toString()', '""'); 22 22 23 var complexPattern = ""; 24 for (var i = 0; i < 18; ++i) 25 complexPattern += "a?"; 26 for (var i = 0; i < 18; ++i) 27 complexPattern += "a"; 28 complexPattern = "(" + complexPattern + ")"; 29 30 var complexInput = ""; 31 for (var i = 0; i < 18; ++i) 32 complexInput += "a"; 33 34 shouldBe('new RegExp(complexPattern).exec(complexInput)[0]', 'complexInput'); // Big but OK 35 shouldBe('new RegExp(complexPattern + complexPattern).exec(complexInput + complexInput)', 'null'); // Too big 36 23 37 var s = "a"; 24 38 for (var i = 0; i < 21; i++)
Note: See TracChangeset
for help on using the changeset viewer.