mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-03-29 15:09:46 -06:00
More targeted fix (#4096)
Cyberpunk's issue seems to actually come from the incrementing in the loop. It wasn't clear while debugging, but the problem is that the pattern the game supplies causes match to fail when str_wild_it hits the end, and then tries iterating past end due to the loop condition. Our pattern matching code seems broken for the case Cyberpunk triggers, but since I'm not aware of the intricacies of how real hardware behaves, best to just revert the loop condition change and instead break the loop before the broken iteration.
This commit is contained in:
parent
fc949a7449
commit
1f5430e4c2
@ -330,9 +330,12 @@ static bool match(std::string_view str, std::string_view pattern) {
|
||||
auto pat_it = pattern.begin();
|
||||
while (str_it != str.end() && pat_it != pattern.end()) {
|
||||
if (*pat_it == '%') { // 0 or more wildcard
|
||||
for (auto str_wild_it = str_it; str_wild_it < str.end(); ++str_wild_it) {
|
||||
for (auto str_wild_it = str_it; str_wild_it <= str.end(); ++str_wild_it) {
|
||||
if (match({str_wild_it, str.end()}, {pat_it + 1, pattern.end()})) {
|
||||
return true;
|
||||
} else if (str_wild_it == str.end()) {
|
||||
// Avoid incrementing str_wild_it past str.end().
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user