Skip to content

Commit 46522af

Browse files
committed
patch 8.0.0339: illegal memory access with vi'
Problem: Illegal memory access with vi' Solution: For quoted text objects bail out if the Visual area spans more than one line.
1 parent 8034520 commit 46522af

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

src/search.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4357,6 +4357,10 @@ current_quote(
43574357
/* Correct cursor when 'selection' is exclusive */
43584358
if (VIsual_active)
43594359
{
4360+
/* this only works within one line */
4361+
if (VIsual.lnum != curwin->w_cursor.lnum)
4362+
return FALSE;
4363+
43604364
vis_bef_curs = lt(VIsual, curwin->w_cursor);
43614365
if (*p_sel == 'e' && vis_bef_curs)
43624366
dec_cursor();

src/testdir/test_visual.vim

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,10 @@ func Test_Visual_vapo()
4343
normal vapo
4444
bwipe!
4545
endfunc
46+
47+
func Test_Visual_inner_quote()
48+
new
49+
normal oxX
50+
normal vki'
51+
bwipe!
52+
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
339,
767769
/**/
768770
338,
769771
/**/

0 commit comments

Comments
 (0)