Ignore:
Timestamp:
Feb 27, 2012, 9:22:29 AM (13 years ago)
Author:
[email protected]
Message:

Error check regexp min quantifier
https://bugs.webkit.org/show_bug.cgi?id=70648

Reviewed by Gavin Barraclough.

Source/JavaScriptCore:

Added checking for min or only quantifier being UINT_MAX.
When encountered this becomes a SyntaxError during parsing.

  • yarr/YarrParser.h:

(JSC::Yarr::Parser::parseQuantifier):
(JSC::Yarr::Parser::parse):
(Parser):

LayoutTests:

New test added to check for newly generated SyntaxError.

  • fast/regex/overflow-expected.txt:
  • fast/regex/script-tests/overflow.js:

(quantifyMaxInt):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/yarr/YarrParser.h

    r100167 r108999  
    5555        QuantifierOutOfOrder,
    5656        QuantifierWithoutAtom,
     57        QuantifierTooLarge,
    5758        MissingParentheses,
    5859        ParenthesesUnmatched,
     
    547548        ASSERT(min <= max);
    548549
     550        if (min == UINT_MAX) {
     551            m_err = QuantifierTooLarge;
     552            return;
     553        }
     554
    549555        if (lastTokenWasAnAtom)
    550556            m_delegate.quantifyAtom(min, max, !tryConsume('?'));
     
    686692            REGEXP_ERROR_PREFIX "numbers out of order in {} quantifier",
    687693            REGEXP_ERROR_PREFIX "nothing to repeat",
     694            REGEXP_ERROR_PREFIX "number too large in {} quantifier",
    688695            REGEXP_ERROR_PREFIX "missing )",
    689696            REGEXP_ERROR_PREFIX "unmatched parentheses",
     
    696703        return errorMessages[m_err];
    697704    }
    698 
    699705
    700706    // Misc helper functions:
Note: See TracChangeset for help on using the changeset viewer.