1
0
forked from aniani/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.
This commit is contained in:
Bram Moolenaar
2022-01-30 16:42:56 +00:00
parent 848faddb87
commit 679d66c2d2
3 changed files with 15 additions and 2 deletions

View File

@@ -1267,8 +1267,8 @@ reg_match_visual(void)
colnr_T cols;
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;
if (VIsual_active)