aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/regexp.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-12-03 20:15:52 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-12-03 21:21:47 +0800
commitf6caa35e6576dc97a70a31e1919a320d67f169ca (patch)
tree9ac0f0b8ad381785b7dbb3490bbd302a09ba1023 /src/nvim/regexp.c
parentb69c5817619c8922039e75e9aaaed06ae35ee002 (diff)
downloadrneovim-f6caa35e6576dc97a70a31e1919a320d67f169ca.tar.gz
rneovim-f6caa35e6576dc97a70a31e1919a320d67f169ca.tar.bz2
rneovim-f6caa35e6576dc97a70a31e1919a320d67f169ca.zip
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. https://github.com/vim/vim/commit/679d66c2d21dfe03d0f89b9a818b0aaebb4c3b87 Use CheckScriptFailure() instead of v9.CheckScriptFailure(). Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'src/nvim/regexp.c')
-rw-r--r--src/nvim/regexp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c
index 70584c2a6c..e81df736a4 100644
--- a/src/nvim/regexp.c
+++ b/src/nvim/regexp.c
@@ -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;
}