Changeset 243839 in webkit
- Timestamp:
- Apr 3, 2019, 4:51:12 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/js/regexp-unicode-expected.txt (modified) (1 diff)
-
LayoutTests/js/script-tests/regexp-unicode.js (modified) (1 diff)
-
Source/JavaScriptCore/ChangeLog (modified) (1 diff)
-
Source/JavaScriptCore/yarr/YarrJIT.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r243828 r243839 1 2019-04-03 Michael Saboff <msaboff@apple.com> 2 3 REGRESSION (r243642): com.apple.JavaScriptCore crash in JSC::RegExpObject::execInline 4 https://bugs.webkit.org/show_bug.cgi?id=196477 5 6 Reviewed by Keith Miller. 7 8 Updated the test with a couple more test cases to test a few variants of this bug. 9 Also added a couple of non-greedy counted non-BMP character class tests that don't have 10 the bug just to be sure. 11 12 * js/regexp-unicode-expected.txt: 13 * js/script-tests/regexp-unicode.js: 14 1 15 2019-04-03 Myles C. Maxfield <mmaxfield@apple.com> 2 16 -
trunk/LayoutTests/js/regexp-unicode-expected.txt
r221111 r243839 149 149 PASS "𐌑𐌐𐌑".match(/[𐌁𐌑]+a|[𐌐𐌑]+./iu)[0] is "𐌑𐌐𐌑" 150 150 PASS "𐌑𐌐𐌑".match(/[𐌁𐌑]+?a|[𐌐𐌑]+?./iu)[0] is "𐌑𐌐" 151 PASS "𐌑𐌐𐌑".match(/[𐌁𐌑]+?a$|[𐌐𐌑]+?.$/iu)[0] is "𐌑𐌐𐌑" 152 PASS "𐌑𐌐𐌑".match(/[𐌁𐌑x]+a|[𐌐𐌑x]+./iu)[0] is "𐌑𐌐𐌑" 153 PASS "𐌑𐌐𐌑".match(/[𐌁𐌑x]+?a|[𐌐𐌑x]+?./iu)[0] is "𐌑𐌐" 151 154 PASS "C83|НАЧАТЬ".match(re8)[0] is "C83|НАЧАТЬ" 152 155 PASS "This.Is.16.Chars|НАЧАТЬ".match(re8)[0] is "This.Is.16.Chars|НАЧАТЬ" -
trunk/LayoutTests/js/script-tests/regexp-unicode.js
r221111 r243839 206 206 shouldBe('"\u{10311}\u{10310}\u{10311}".match(/[\u{10301}\u{10311}]+a|[\u{10310}\u{10311}]+./iu)[0]', '"\u{10311}\u{10310}\u{10311}"'); 207 207 shouldBe('"\u{10311}\u{10310}\u{10311}".match(/[\u{10301}\u{10311}]+?a|[\u{10310}\u{10311}]+?./iu)[0]', '"\u{10311}\u{10310}"'); 208 shouldBe('"\u{10311}\u{10310}\u{10311}".match(/[\u{10301}\u{10311}]+?a$|[\u{10310}\u{10311}]+?.$/iu)[0]', '"\u{10311}\u{10310}\u{10311}"'); 209 shouldBe('"\u{10311}\u{10310}\u{10311}".match(/[\u{10301}\u{10311}x]+a|[\u{10310}\u{10311}x]+./iu)[0]', '"\u{10311}\u{10310}\u{10311}"'); 210 shouldBe('"\u{10311}\u{10310}\u{10311}".match(/[\u{10301}\u{10311}x]+?a|[\u{10310}\u{10311}x]+?./iu)[0]', '"\u{10311}\u{10310}"'); 208 211 209 212 var re8 = new RegExp("^([0-9a-z\.]{3,16})\\|\u{041d}\u{0410}\u{0427}\u{0410}\u{0422}\u{042c}", "ui"); -
trunk/Source/JavaScriptCore/ChangeLog
r243835 r243839 1 2019-04-03 Michael Saboff <msaboff@apple.com> 2 3 REGRESSION (r243642): com.apple.JavaScriptCore crash in JSC::RegExpObject::execInline 4 https://bugs.webkit.org/show_bug.cgi?id=196477 5 6 Reviewed by Keith Miller. 7 8 The problem here is that when we advance the index by 2 for a character class that only 9 has non-BMP characters, we might go past the end of the string. This can happen for 10 greedy counted character classes that are part of a alternative where there is one 11 character to match after the greedy non-BMP character class. 12 13 The "do we have string left to match" check at the top of the JIT loop for the counted 14 character class checks to see if index is not equal to the string length. For non-BMP 15 character classes, we need to check to see if there are at least 2 characters left. 16 Therefore we now temporarily add 1 to the current index before comparing. This checks 17 to see if there are iat least 2 characters left to match, instead of 1. 18 19 * yarr/YarrJIT.cpp: 20 (JSC::Yarr::YarrGenerator::generateCharacterClassGreedy): 21 (JSC::Yarr::YarrGenerator::backtrackCharacterClassNonGreedy): 22 1 23 2019-04-03 Yusuke Suzuki <ysuzuki@apple.com> 2 24 -
trunk/Source/JavaScriptCore/yarr/YarrJIT.cpp
r243642 r243839 1850 1850 JumpList failures; 1851 1851 Label loop(this); 1852 failures.append(atEndOfInput()); 1852 #ifdef JIT_UNICODE_EXPRESSIONS 1853 if (term->characterClass->hasOneCharacterSize() && !term->invert() && term->characterClass->hasNonBMPCharacters()) { 1854 move(TrustedImm32(1), character); 1855 failures.append(checkNotEnoughInput(character)); 1856 } else 1857 #endif 1858 failures.append(atEndOfInput()); 1853 1859 1854 1860 if (term->invert()) { … … 1957 1963 m_backtrackingState.link(this); 1958 1964 1965 #ifdef JIT_UNICODE_EXPRESSIONS 1959 1966 if (m_decodeSurrogatePairs) { 1960 1967 if (!term->characterClass->hasOneCharacterSize() || term->invert()) … … 1962 1969 loadFromFrame(term->frameLocation + BackTrackInfoCharacterClass::matchAmountIndex(), countRegister); 1963 1970 } 1971 #endif 1964 1972 1965 1973 nonGreedyFailures.append(atEndOfInput());
Note:
See TracChangeset
for help on using the changeset viewer.