Changeset 274945 in webkit


Ignore:
Timestamp:
Mar 24, 2021 10:29:02 AM (16 months ago)
Author:
msaboff@apple.com
Message:

[YARR] Interpreter incorrectly matches non-BMP characters with multiple . w/dotAll flag
https://bugs.webkit.org/show_bug.cgi?id=223666

Reviewed by Mark Lam.

JSTests:

Added tests for dotAll. Also made sure that we test both JIT and non-JIT execution.

  • stress/regexp-dot-match-nonBMP.js:

Source/JavaScriptCore:

In checkCharacterClassDontAdvanceInputForNonBMP(), we need to check for input.readChecked() returning -1
and return that the character class didn't match.

  • yarr/YarrInterpreter.cpp:

(JSC::Yarr::Interpreter::checkCharacterClassDontAdvanceInputForNonBMP):

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r274935 r274945  
     12021-03-24  Michael Saboff  <msaboff@apple.com>
     2
     3        [YARR] Interpreter incorrectly matches non-BMP characters with multiple . w/dotAll flag
     4        https://bugs.webkit.org/show_bug.cgi?id=223666
     5
     6        Reviewed by Mark Lam.
     7
     8        Added tests for dotAll.  Also made sure that we test both JIT and non-JIT execution.
     9
     10        * stress/regexp-dot-match-nonBMP.js:
     11
    1122021-03-24  Yusuke Suzuki  <ysuzuki@apple.com>
    213
  • trunk/JSTests/stress/regexp-dot-match-nonBMP.js

    r274806 r274945  
     1//@ runDefault
     2//@ runNoJIT
     3
    14function shouldMatch(regexp, str) {
    25    let result = regexp.test(str);
     
    1922shouldntMatch(/.../, s);
    2023shouldntMatch(/.../u, s);
     24
     25shouldMatch(/./s, s);
     26shouldMatch(/./su, s);
     27shouldMatch(/../s, s);
     28shouldntMatch(/../su, s);
     29shouldntMatch(/.../s, s);
     30shouldntMatch(/.../su, s);
  • trunk/Source/JavaScriptCore/ChangeLog

    r274942 r274945  
     12021-03-24  Michael Saboff  <msaboff@apple.com>
     2
     3        [YARR] Interpreter incorrectly matches non-BMP characters with multiple . w/dotAll flag
     4        https://bugs.webkit.org/show_bug.cgi?id=223666
     5
     6        Reviewed by Mark Lam.
     7
     8        In checkCharacterClassDontAdvanceInputForNonBMP(), we need to check for input.readChecked() returning -1
     9        and return that the character class didn't match.
     10
     11        * yarr/YarrInterpreter.cpp:
     12        (JSC::Yarr::Interpreter::checkCharacterClassDontAdvanceInputForNonBMP):
     13
    1142021-03-24  Saam Barati  <sbarati@apple.com>
    215
  • trunk/Source/JavaScriptCore/yarr/YarrInterpreter.cpp

    r274806 r274945  
    437437    {
    438438        int readCharacter = characterClass->hasOnlyNonBMPCharacters() ? input.readSurrogatePairChecked(negativeInputOffset) :  input.readChecked(negativeInputOffset);
     439        if (readCharacter < 0)
     440            return false;
     441
    439442        return testCharacterClass(characterClass, readCharacter);
    440443    }
Note: See TracChangeset for help on using the changeset viewer.