Changeset 41849 in webkit


Ignore:
Timestamp:
Mar 19, 2009 5:52:04 PM (15 years ago)
Author:
ggaren@apple.com
Message:

JavaScriptCore:

2009-03-19 Cameron Zwarich <cwzwarich@uwaterloo.ca>

Reviewed by Geoff Garen.

Bug 23771: REGRESSION (r36016): JSObjectHasProperty freezes on global class without kJSClassAttributeNoAutomaticPrototype
<https://bugs.webkit.org/show_bug.cgi?id=23771>
<rdar://problem/6561016>

  • API/tests/testapi.c: (main): Add a test for this bug.
  • runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::resetPrototype): Don't set the prototype of the last object in the prototype chain to the object prototype when the object prototype is already the last object in the prototype chain.

LayoutTests:

2009-03-19 Geoffrey Garen <ggaren@apple.com>

Reviewed by Oliver Hunt.


Fixed <rdar://problem/6279213> Regular expression run-time complexity
limit too low for long inputs (21485)


Added a test for a complex regexp match that should succeed, and one
that should fail.

  • fast/js/regexp-overflow-expected.txt:
  • fast/js/resources/regexp-overflow.js:
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r41846 r41849  
    2121
    2222        * wtf/Platform.h: Added HAVE_RUNLOOP_TIMER for PLATFORM(MAC).
     23
     242009-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:
    2342
    24432009-03-19  Geoffrey Garen  <ggaren@apple.com>
  • trunk/JavaScriptCore/pcre/pcre_exec.cpp

    r41252 r41849  
    176176avoid spending exponential time on complex regular expressions. */
    177177
    178 static const unsigned matchLimit = 100000;
     178static const unsigned matchLimit = 1000000;
    179179
    180180#ifdef DEBUG
  • trunk/LayoutTests/ChangeLog

    r41848 r41849  
     12009-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
    1142009-03-19  Mark Rowe  <mrowe@apple.com>
    215
  • trunk/LayoutTests/fast/js/regexp-overflow-expected.txt

    r31388 r41849  
    1313PASS /{([\D-\ca]]„£µ+?)}|[[\B-\u00d4]√π- ]]]{0,3}/i.exec("B√π- ]]").toString() is "B√π- ]],"
    1414PASS /|[x\B-\u00b5]/i.exec("").toString() is ""
     15PASS new RegExp(complexPattern).exec(complexInput)[0] is complexInput
     16PASS new RegExp(complexPattern + complexPattern).exec(complexInput + complexInput) is null
    1517PASS new RegExp(s); threw exception SyntaxError: Invalid regular expression: regular expression too large.
    1618PASS /(([ab]){30}){3360}/ threw exception SyntaxError: Invalid regular expression: regular expression too large.
  • trunk/LayoutTests/fast/js/resources/regexp-overflow.js

    r41842 r41849  
    2121shouldBe('/|[x\\B-\\u00b5]/i.exec("").toString()', '""');
    2222
     23var complexPattern = "";
     24for (var i = 0; i < 18; ++i)
     25    complexPattern += "a?";
     26for (var i = 0; i < 18; ++i)
     27    complexPattern += "a";
     28complexPattern = "(" + complexPattern + ")";
     29
     30var complexInput = "";
     31for (var i = 0; i < 18; ++i)
     32    complexInput += "a";
     33
     34shouldBe('new RegExp(complexPattern).exec(complexInput)[0]', 'complexInput'); // Big but OK
     35shouldBe('new RegExp(complexPattern + complexPattern).exec(complexInput + complexInput)', 'null'); // Too big
     36
    2337var s = "a";
    2438for (var i = 0; i < 21; i++)
Note: See TracChangeset for help on using the changeset viewer.