Changeset 276529 in webkit
- Timestamp:
- Apr 23, 2021, 4:38:34 PM (5 years ago)
- Location:
- branches/safari-611-branch/Source/JavaScriptCore
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
yarr/YarrInterpreter.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-611-branch/Source/JavaScriptCore/ChangeLog
r276525 r276529 1 2021-04-23 Ruben Turcios <rubent_22@apple.com> 2 3 Cherry-pick r276527. rdar://problem/77091667 4 5 [YARR Interpreter] Improper backtrack of parentheses with non-zero based greedy quantifiers 6 https://bugs.webkit.org/show_bug.cgi?id=224983 7 8 Reviewed by Mark Lam. 9 10 When we backtrack a parentheses with a greedy non zero based quantifier, 11 we don't properly restore for the case where we hadn't reached the minimum count. 12 We now save the input position on entry and restore it when we backtrack for 13 this case. We also properly release the allocated ParenthesesDisjunctionContext's. 14 15 * yarr/YarrInterpreter.cpp: 16 (JSC::Yarr::Interpreter::matchParentheses): 17 (JSC::Yarr::Interpreter::backtrackParentheses): 18 19 20 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276527 268f45cc-cd09-0410-ab3c-d52691b4dbfc 21 22 2021-04-23 Michael Saboff <msaboff@apple.com> 23 24 [YARR Interpreter] Improper backtrack of parentheses with non-zero based greedy quantifiers 25 https://bugs.webkit.org/show_bug.cgi?id=224983 26 27 Reviewed by Mark Lam. 28 29 When we backtrack a parentheses with a greedy non zero based quantifier, 30 we don't properly restore for the case where we hadn't reached the minimum count. 31 We now save the input position on entry and restore it when we backtrack for 32 this case. We also properly release the allocated ParenthesesDisjunctionContext's. 33 34 * yarr/YarrInterpreter.cpp: 35 (JSC::Yarr::Interpreter::matchParentheses): 36 (JSC::Yarr::Interpreter::backtrackParentheses): 37 1 38 2021-04-23 Ruben Turcios <rubent_22@apple.com> 2 39 -
branches/safari-611-branch/Source/JavaScriptCore/yarr/YarrInterpreter.cpp
r261755 r276529 46 46 47 47 struct BackTrackInfoParentheses { 48 uintptr_t begin; 48 49 uintptr_t matchAmount; 49 50 ParenthesesDisjunctionContext* lastContext; … … 1016 1017 ByteDisjunction* disjunctionBody = term.atom.parenthesesDisjunction; 1017 1018 1019 backTrack->begin = input.getPos(); 1018 1020 backTrack->matchAmount = 0; 1019 1021 backTrack->lastContext = nullptr; … … 1169 1171 freeParenthesesDisjunctionContext(context); 1170 1172 1171 if (result != JSRegExpNoMatch || backTrack->matchAmount < term.atom.quantityMinCount) 1173 if (backTrack->matchAmount < term.atom.quantityMinCount) { 1174 while (backTrack->matchAmount) { 1175 context = backTrack->lastContext; 1176 resetMatches(term, context); 1177 popParenthesesDisjunctionContext(backTrack); 1178 freeParenthesesDisjunctionContext(context); 1179 } 1180 1181 input.setPos(backTrack->begin); 1182 return result; 1183 } 1184 1185 if (result != JSRegExpNoMatch) 1172 1186 return result; 1173 1187 }
Note:
See TracChangeset
for help on using the changeset viewer.