Changeset 242838 in webkit
- Timestamp:
- Mar 12, 2019 6:26:29 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r242810 r242838 1 2019-03-12 Michael Saboff <msaboff@apple.com> 2 3 REGRESSION (iOS 12.2): Webpage using CoffeeScript crashes 4 https://bugs.webkit.org/show_bug.cgi?id=195613 5 6 Reviewed by Mark Lam. 7 8 New regression test. 9 10 * stress/regexp-backref-inbounds.js: Added. 11 (testRegExp): 12 1 13 2019-03-12 Mark Lam <mark.lam@apple.com> 2 14 -
trunk/Source/JavaScriptCore/ChangeLog
r242812 r242838 1 2019-03-12 Michael Saboff <msaboff@apple.com> 2 3 REGRESSION (iOS 12.2): Webpage using CoffeeScript crashes 4 https://bugs.webkit.org/show_bug.cgi?id=195613 5 6 Reviewed by Mark Lam. 7 8 The bug here is in Yarr JIT backreference matching code. We are incorrectly 9 using a checkedOffset / inputPosition correction when checking for the available 10 length left in a string. It is improper to do these corrections as a backreference's 11 match length is based on what was matched in the referenced capture group and not 12 part of the checkedOffset and inputPosition computed when we compiled the RegExp. 13 In some cases, the resulting incorrect calculation would allow us to go past 14 the subject string's length. Removed these adjustments. 15 16 After writing tests for the first bug, found another bug where the non-greedy 17 backreference backtracking code didn't do an "are we at the end of the input?" check. 18 This caused an infinite loop as we'd jump from the backtracking code back to 19 try matching one more backreference, fail and then backtrack. 20 21 * yarr/YarrJIT.cpp: 22 (JSC::Yarr::YarrGenerator::generateBackReference): 23 (JSC::Yarr::YarrGenerator::backtrackBackReference): 24 1 25 2019-03-12 Robin Morisset <rmorisset@apple.com> 2 26 -
trunk/Source/JavaScriptCore/yarr/YarrJIT.cpp
r241634 r242838 1199 1199 // PatternTemp should contain pattern end index at this point 1200 1200 sub32(patternIndex, patternTemp); 1201 if (m_checkedOffset - term->inputPosition)1202 sub32(Imm32((m_checkedOffset - term->inputPosition).unsafeGet()), patternTemp);1203 1201 op.m_jumps.append(checkNotEnoughInput(patternTemp)); 1204 1202 … … 1225 1223 // PatternTemp should contain pattern end index at this point 1226 1224 sub32(patternIndex, patternTemp); 1227 if (m_checkedOffset - term->inputPosition)1228 sub32(Imm32((m_checkedOffset - term->inputPosition).unsafeGet()), patternTemp);1229 1225 matches.append(checkNotEnoughInput(patternTemp)); 1230 1226 … … 1271 1267 // Check if we have input remaining to match 1272 1268 sub32(patternIndex, patternTemp); 1273 if (m_checkedOffset - term->inputPosition)1274 sub32(Imm32((m_checkedOffset - term->inputPosition).unsafeGet()), patternTemp);1275 1269 matches.append(checkNotEnoughInput(patternTemp)); 1276 1270 … … 1329 1323 const RegisterID matchAmount = regT0; 1330 1324 1325 failures.append(atEndOfInput()); 1331 1326 loadFromFrame(parenthesesFrameLocation + BackTrackInfoBackReference::matchAmountIndex(), matchAmount); 1332 1327 if (term->quantityMaxCount != quantifyInfinite)
Note: See TracChangeset
for help on using the changeset viewer.