comparison src/search.c @ 25511:a6eea433586b v8.2.3292

patch 8.2.3292: underscore in very magic pattern causes a hang Commit: https://github.com/vim/vim/commit/bc67e5a0a494f5fc48e872d747371e31a782d171 Author: Christian Brabandt <cb@256bit.org> Date: Thu Aug 5 15:24:59 2021 +0200 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 #8707, closes #8704, closes #8705)
author Bram Moolenaar <Bram@vim.org>
date Thu, 05 Aug 2021 15:30:04 +0200
parents b95f9cc3d1b9
children 8369fcaad30d
comparison
equal deleted inserted replaced
25510:d390d493f704 25511:a6eea433586b
443 { 443 {
444 if (enc_utf8 && utf_isupper(utf_ptr2char(p))) 444 if (enc_utf8 && utf_isupper(utf_ptr2char(p)))
445 return TRUE; 445 return TRUE;
446 p += l; 446 p += l;
447 } 447 }
448 else if (*p == '\\' && magic_val == MAGIC_ON) 448 else if (*p == '\\' && magic_val <= MAGIC_ON)
449 { 449 {
450 if (p[1] == '_' && p[2] != NUL) // skip "\_X" 450 if (p[1] == '_' && p[2] != NUL) // skip "\_X"
451 p += 3; 451 p += 3;
452 else if (p[1] == '%' && p[2] != NUL) // skip "\%X" 452 else if (p[1] == '%' && p[2] != NUL) // skip "\%X"
453 p += 3; 453 p += 3;
458 } 458 }
459 else if ((*p == '%' || *p == '_') && magic_val == MAGIC_ALL) 459 else if ((*p == '%' || *p == '_') && magic_val == MAGIC_ALL)
460 { 460 {
461 if (p[1] != NUL) // skip "_X" and %X 461 if (p[1] != NUL) // skip "_X" and %X
462 p += 2; 462 p += 2;
463 else
464 p++;
463 } 465 }
464 else if (MB_ISUPPER(*p)) 466 else if (MB_ISUPPER(*p))
465 return TRUE; 467 return TRUE;
466 else 468 else
467 ++p; 469 ++p;