Skip to content
  • ggaren@apple.com's avatar
    JavaScriptCore: · 287f42dc
    ggaren@apple.com authored
    2009-03-19  Geoffrey Garen  <ggaren@apple.com>
    
            Reviewed by Sam Weinig.
            
            Fixed <rdar://problem/6603562> REGRESSION (Safari 4): regular expression
            pattern size limit lower than Safari 3.2, other browsers, breaks SAP (14873)
            
            Bumped the pattern size limit to 1MB, and standardized it between PCRE
            and WREC. (Empirical testing says that we can easily compile a 1MB regular
            expression without risking a hang. Other browsers support bigger regular
            expressions, but also hang.)
            
            SunSpider reports no change.
            
            I started with a patch posted to Bugzilla by Erik Corry (erikcorry@google.com).
            
            * pcre/pcre_internal.h:
            (put3ByteValue):
            (get3ByteValue):
            (put3ByteValueAndAdvance):
            (putLinkValueAllowZero):
            (getLinkValueAllowZero): Made PCRE's "LINK_SIZE" (the number of bytes
            used to record jumps between bytecodes) 3, to accomodate larger potential
            jumps. Bumped PCRE's "MAX_PATTERN_SIZE" to 1MB. (Technically, at this
            LINK_SIZE, we can support even larger patterns, but we risk a hang during
            compilation, and it's not clear that such large patterns are important
            on the web.)
    
            * wrec/WREC.cpp:
            (JSC::WREC::Generator::compileRegExp): Match PCRE's maximum pattern size,
            to avoid quirks between platforms.
    
    LayoutTests:
    
    2009-03-19  Geoffrey Garen  <ggaren@apple.com>
    
            Reviewed by Sam Weinig.
            
            Made two layout tests less agressive, to accomodate a change I made
            for <rdar://problem/6603562> REGRESSION (Safari 4): regular expression
            pattern size limit lower than Safari 3.2, other browsers, breaks SAP (14873)
    
            * fast/js/regexp-charclass-crash-expected.txt:
            * fast/js/regexp-charclass-crash.html: Explicitly limit the number of iterations
            in the test loop. Otherwise, regular expression engines supporting very
            long patterns take a very very very long time to run this test.
    
            * fast/js/resources/regexp-overflow.js: Made the "too big" regexp in
            this test even bigger, to match our new limit.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@41842 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    287f42dc