Changeset 205937 in webkit


Ignore:
Timestamp:
Sep 14, 2016 4:17:59 PM (8 years ago)
Author:
msaboff@apple.com
Message:

YARR doesn't check for invalid flags for literal regular expressions
https://bugs.webkit.org/show_bug.cgi?id=161995

Reviewed by Mark Lam.

JSTests:

New test.

  • stress/regress-161995.js: Added.

(testStatic):
(catch):

Source/JavaScriptCore:

Added a new error and a check that the flags are valid when we create a
literal regular expression.

  • runtime/RegExp.cpp:

(JSC::RegExp::finishCreation):

  • yarr/YarrPattern.cpp:

(JSC::Yarr::YarrPattern::errorMessage):
(JSC::Yarr::YarrPattern::compile):

  • yarr/YarrPattern.h:
Location:
trunk
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r205932 r205937  
     12016-09-14  Michael Saboff  <msaboff@apple.com>
     2
     3        YARR doesn't check for invalid flags for literal regular expressions
     4        https://bugs.webkit.org/show_bug.cgi?id=161995
     5
     6        Reviewed by Mark Lam.
     7
     8        New test.
     9
     10        * stress/regress-161995.js: Added.
     11        (testStatic):
     12        (catch):
     13
    1142016-09-14  Joseph Pecoraro  <pecoraro@apple.com>
    215
  • trunk/Source/JavaScriptCore/ChangeLog

    r205936 r205937  
     12016-09-14  Michael Saboff  <msaboff@apple.com>
     2
     3        YARR doesn't check for invalid flags for literal regular expressions
     4        https://bugs.webkit.org/show_bug.cgi?id=161995
     5
     6        Reviewed by Mark Lam.
     7
     8        Added a new error and a check that the flags are valid when we create a
     9        literal regular expression.
     10
     11        * runtime/RegExp.cpp:
     12        (JSC::RegExp::finishCreation):
     13        * yarr/YarrPattern.cpp:
     14        (JSC::Yarr::YarrPattern::errorMessage):
     15        (JSC::Yarr::YarrPattern::compile):
     16        * yarr/YarrPattern.h:
     17
    1182016-09-14  Keith Miller  <keith_miller@apple.com>
    219
  • trunk/Source/JavaScriptCore/runtime/RegExp.cpp

    r205462 r205937  
    224224    Base::finishCreation(vm);
    225225    Yarr::YarrPattern pattern(m_patternString, m_flags, &m_constructionError, vm.stackLimit());
    226     if (m_constructionError)
     226    if (!isValid())
    227227        m_state = ParseError;
    228228    else
  • trunk/Source/JavaScriptCore/yarr/YarrPattern.cpp

    r203452 r205937  
    908908        REGEXP_ERROR_PREFIX "invalid escaped character for unicode pattern",
    909909        REGEXP_ERROR_PREFIX "too many nested disjunctions",
    910         REGEXP_ERROR_PREFIX "pattern exceeds string length limits"
     910        REGEXP_ERROR_PREFIX "pattern exceeds string length limits",
     911        REGEXP_ERROR_PREFIX "invalid flags"
    911912    };
    912913
     
    917918{
    918919    YarrPatternConstructor constructor(*this, stackLimit);
     920
     921    if (m_flags == InvalidFlags)
     922        return errorMessage(InvalidRegularExpressionFlags);
    919923
    920924    if (const char* error = parse(constructor, patternString, unicode()))
  • trunk/Source/JavaScriptCore/yarr/YarrPattern.h

    r205020 r205937  
    322322        TooManyDisjunctions,
    323323        OffsetTooLarge,
     324        InvalidRegularExpressionFlags,
    324325        NumberOfErrorCodes
    325326    };
Note: See TracChangeset for help on using the changeset viewer.