Changeset 276527 in webkit
- Timestamp:
- Apr 23, 2021, 4:06:12 PM (5 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
yarr/YarrInterpreter.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r276524 r276527 1 2021-04-23 Michael Saboff <msaboff@apple.com> 2 3 [YARR Interpreter] Improper backtrack of parentheses with non-zero based greedy quantifiers 4 https://bugs.webkit.org/show_bug.cgi?id=224983 5 6 Reviewed by Mark Lam. 7 8 When we backtrack a parentheses with a greedy non zero based quantifier, 9 we don't properly restore for the case where we hadn't reached the minimum count. 10 We now save the input position on entry and restore it when we backtrack for 11 this case. We also properly release the allocated ParenthesesDisjunctionContext's. 12 13 * yarr/YarrInterpreter.cpp: 14 (JSC::Yarr::Interpreter::matchParentheses): 15 (JSC::Yarr::Interpreter::backtrackParentheses): 16 1 17 2021-04-23 Mark Lam <mark.lam@apple.com> 2 18 -
trunk/Source/JavaScriptCore/yarr/YarrInterpreter.cpp
r274945 r276527 46 46 47 47 struct BackTrackInfoParentheses { 48 uintptr_t begin; 48 49 uintptr_t matchAmount; 49 50 ParenthesesDisjunctionContext* lastContext; … … 1023 1024 ByteDisjunction* disjunctionBody = term.atom.parenthesesDisjunction; 1024 1025 1026 backTrack->begin = input.getPos(); 1025 1027 backTrack->matchAmount = 0; 1026 1028 backTrack->lastContext = nullptr; … … 1176 1178 freeParenthesesDisjunctionContext(context); 1177 1179 1178 if (result != JSRegExpNoMatch || backTrack->matchAmount < term.atom.quantityMinCount) 1180 if (backTrack->matchAmount < term.atom.quantityMinCount) { 1181 while (backTrack->matchAmount) { 1182 context = backTrack->lastContext; 1183 resetMatches(term, context); 1184 popParenthesesDisjunctionContext(backTrack); 1185 freeParenthesesDisjunctionContext(context); 1186 } 1187 1188 input.setPos(backTrack->begin); 1189 return result; 1190 } 1191 1192 if (result != JSRegExpNoMatch) 1179 1193 return result; 1180 1194 }
Note:
See TracChangeset
for help on using the changeset viewer.