vim-patch:8.0.0324 (#7279)

Problem:    Illegal memory access with "1;y".
Solution:   Call check_cursor() instead of check_cursor_lnum(). (Dominique
            Pelle, closes vim/vim#1455)

f1f6f3f7df
This commit is contained in:
KunMing Xie
2017-09-18 02:04:17 +08:00
committed by Justin M. Keyes
parent 009c695f0a
commit cf59d617bc
3 changed files with 16 additions and 4 deletions

View File

@@ -1668,8 +1668,8 @@ static char_u * do_one_cmd(char_u **cmdlinep,
if (*ea.cmd == ';') { if (*ea.cmd == ';') {
if (!ea.skip) { if (!ea.skip) {
curwin->w_cursor.lnum = ea.line2; curwin->w_cursor.lnum = ea.line2;
// Don't leave the cursor on an illegal line (caused by ';') // don't leave the cursor on an illegal line or column
check_cursor_lnum(); check_cursor();
} }
} else if (*ea.cmd != ',') { } else if (*ea.cmd != ',') {
break; break;

View File

@@ -250,9 +250,21 @@ func Test_remove_char_in_cmdline()
call assert_equal('"def', @:) call assert_equal('"def', @:)
endfunc endfunc
func Test_illegal_address() func Test_illegal_address1()
new new
2;'( 2;'(
2;') 2;')
quit quit
endfunc endfunc
func Test_illegal_address2()
call writefile(['c', 'x', ' x', '.', '1;y'], 'Xtest.vim')
new
source Xtest.vim
" Trigger calling validate_cursor()
diffsp Xtest.vim
quit!
bwipe!
call delete('Xtest.vim')
endfunc

View File

@@ -628,7 +628,7 @@ static const int included_patches[] = {
// 327, // 327,
326, 326,
325, 325,
// 324, 324,
// 323, // 323,
322, 322,
// 321, // 321,