vim-patch:8.2.4261: accessing invalid memory in a regular expression

Problem:    Accessing invalid memory when a regular expression checks the
            Visual area while matching in a string.
Solution:   Do not try matching the Visual area in a string.

679d66c2d2

Use CheckScriptFailure() instead of v9.CheckScriptFailure().

Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
zeertzjq
2022-12-03 20:15:52 +08:00
parent b69c581761
commit f6caa35e65
3 changed files with 39 additions and 2 deletions

View File

@@ -1094,8 +1094,8 @@ static bool reg_match_visual(void)
colnr_T start2, end2;
colnr_T curswant;
// Check if the buffer is the current buffer.
if (rex.reg_buf != curbuf || VIsual.lnum == 0) {
// Check if the buffer is the current buffer and not using a string.
if (rex.reg_buf != curbuf || VIsual.lnum == 0 || rex.reg_maxline == 0) {
return false;
}