vim-patch:8.2.3292: underscore in very magic pattern causes a hang

Problem:    Underscore in very magic pattern causes a hang.  Pattern with \V
            are case sensitive. (Yutao Yuan)
Solution:   Adjust condition for magicness and advance pointer. (Christian
            Brabandt, closes vim/vim#8707, closes vim/vim#8704, closes vim/vim#8705)

bc67e5a0a4

Co-authored-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
zeertzjq
2022-12-04 09:46:26 +08:00
parent 3f1ee12d31
commit 9476dd2f92
2 changed files with 14 additions and 1 deletions

View File

@@ -386,7 +386,7 @@ bool pat_has_uppercase(char_u *pat)
return true;
}
p += l;
} else if (*p == '\\' && magic_val == MAGIC_ON) {
} else if (*p == '\\' && magic_val <= MAGIC_ON) {
if (p[1] == '_' && p[2] != NUL) { // skip "\_X"
p += 3;
} else if (p[1] == '%' && p[2] != NUL) { // skip "\%X"
@@ -399,6 +399,8 @@ bool pat_has_uppercase(char_u *pat)
} else if ((*p == '%' || *p == '_') && magic_val == MAGIC_ALL) {
if (p[1] != NUL) { // skip "_X" and %X
p += 2;
} else {
p++;
}
} else if (mb_isupper(*p)) {
return true;