diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-10-11 15:40:43 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-10-11 15:40:43 +0100 |
commit | b07626d4afa73dd2af0f03c0d59eed25ee159ef9 (patch) | |
tree | 3d4c106e4390dfe22993a551c3e7892e032c10a2 /src | |
parent | cddd5ac911707034ca27f10037c4b1b523188c47 (diff) | |
download | vim-git-b07626d4afa73dd2af0f03c0d59eed25ee159ef9.tar.gz |
patch 8.2.3494: illegal memory access in utf_head_offv8.2.3494
Problem: Illegal memory access in utf_head_off.
Solution: Check cursor position when reselecting the Visual area.
(closes #8963)
Diffstat (limited to 'src')
-rw-r--r-- | src/normal.c | 3 | ||||
-rw-r--r-- | src/testdir/test_visual.vim | 20 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 23 insertions, 2 deletions
diff --git a/src/normal.c b/src/normal.c index 8a4e778bc..9cc2ea924 100644 --- a/src/normal.c +++ b/src/normal.c @@ -5671,8 +5671,7 @@ nv_visual(cmdarg_T *cap) { curwin->w_cursor.lnum += resel_VIsual_line_count * cap->count0 - 1; - if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count) - curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count; + check_cursor(); } VIsual_mode = resel_VIsual_mode; if (VIsual_mode == 'v') diff --git a/src/testdir/test_visual.vim b/src/testdir/test_visual.vim index 10929519b..20eb4b43e 100644 --- a/src/testdir/test_visual.vim +++ b/src/testdir/test_visual.vim @@ -1265,5 +1265,25 @@ func Test_visual_block_with_virtualedit() call delete('XTest_block') endfunc +func Test_visual_reselect_with_count() + " this was causing an illegal memory access + let lines =<< trim END + + + + : + r<sfile> + exe "%norm e3\<c-v>kr\t" + : + + : + END + call writefile(lines, 'XvisualReselect') + source XvisualReselect + + bwipe! + call delete('XvisualReselect') +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index ce1939b0f..f5c8d76a5 100644 --- a/src/version.c +++ b/src/version.c @@ -758,6 +758,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 3494, +/**/ 3493, /**/ 3492, |