Skip to content

Commit f1f6f3f

Browse files
committed
patch 8.0.0324: illegal memory access with a wrong yank range
Problem: Illegal memory access with "1;y". Solution: Call check_cursor() instead of check_cursor_lnum(). (Dominique Pelle, closes #1455)
1 parent 31eb139 commit f1f6f3f

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

src/ex_docmd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2295,8 +2295,8 @@ do_one_cmd(
22952295
if (!ea.skip)
22962296
{
22972297
curwin->w_cursor.lnum = ea.line2;
2298-
/* don't leave the cursor on an illegal line */
2299-
check_cursor_lnum();
2298+
/* don't leave the cursor on an illegal line or column */
2299+
check_cursor();
23002300
}
23012301
}
23022302
else if (*ea.cmd != ',')

src/testdir/test_cmdline.vim

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,13 +289,24 @@ func Test_remove_char_in_cmdline()
289289
call assert_equal('"def', @:)
290290
endfunc
291291

292-
func Test_illegal_address()
292+
func Test_illegal_address1()
293293
new
294294
2;'(
295295
2;')
296296
quit
297297
endfunc
298298

299+
func Test_illegal_address2()
300+
call writefile(['c', 'x', ' x', '.', '1;y'], 'Xtest.vim')
301+
new
302+
source Xtest.vim
303+
" Trigger calling validate_cursor()
304+
diffsp Xtest.vim
305+
quit!
306+
bwipe!
307+
call delete('Xtest.vim')
308+
endfunc
309+
299310
func Test_cmdline_complete_wildoptions()
300311
help
301312
call feedkeys(":tag /\<c-a>\<c-b>\"\<cr>", 'tx')

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+
324,
767769
/**/
768770
323,
769771
/**/

0 commit comments

Comments
 (0)