From 63bb7198dfded8a5c37195ebc8503516a1eda0f3 Mon Sep 17 00:00:00 2001 From: ckelsel Date: Mon, 15 Jan 2018 19:27:10 +0800 Subject: vim-patch:8.0.0398: illegal memory access with "t" Problem: Illegal memory access with "t". Solution: Use strncmp() instead of memcmp(). (Dominique Pelle, closes vim/vim#1528) https://github.com/vim/vim/commit/66727e16079fbac6db3897b5c3736ec9fba995bb --- src/nvim/search.c | 8 ++++---- src/nvim/testdir/test_search.vim | 7 +++++++ 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/nvim/search.c b/src/nvim/search.c index 1eb1a25a19..0a266382ec 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -1382,13 +1382,13 @@ int searchc(cmdarg_T *cap, int t_cmd) col -= (*mb_head_off)(p, p + col - 1) + 1; } if (lastc_bytelen == 1) { - if (p[col] == c && stop) + if (p[col] == c && stop) { break; - } else { - if (memcmp(p + col, lastc_bytes, lastc_bytelen) == 0 && stop) + } + } else if (STRNCMP(p + col, lastc_bytes, lastc_bytelen) == 0 && stop) { break; } - stop = TRUE; + stop = true; } } else { for (;; ) { diff --git a/src/nvim/testdir/test_search.vim b/src/nvim/testdir/test_search.vim index a333e7f206..03112df46f 100644 --- a/src/nvim/testdir/test_search.vim +++ b/src/nvim/testdir/test_search.vim @@ -298,3 +298,10 @@ func Test_searchpair() q! endfunc +func Test_searchc() + " These commands used to cause memory overflow in searchc(). + new + norm ixx + exe "norm 0t\u93cf" + bw! +endfunc -- cgit From 28998cfd815abd690ffa0b9bab786263af619008 Mon Sep 17 00:00:00 2001 From: ckelsel Date: Mon, 15 Jan 2018 19:41:29 +0800 Subject: vim-patch:8.0.0402: :map completion does not have Problem: :map completion does not have . (Dominique Pelle) Solution: Recognize in completion. Add a test. https://github.com/vim/vim/commit/cf5fdf7d1689ecb145b634dcb9c6e9fc60f63869 --- src/nvim/getchar.c | 23 +++++++++++++++-------- src/nvim/testdir/test_cmdline.vim | 20 ++++++++++++++++++++ 2 files changed, 35 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c index 1b5d3472ab..7df1bf8429 100644 --- a/src/nvim/getchar.c +++ b/src/nvim/getchar.c @@ -3366,6 +3366,10 @@ set_context_in_map_cmd ( arg = skipwhite(arg + 8); continue; } + if (STRNCMP(arg, "", 9) == 0) { + arg = skipwhite(arg + 9); + continue; + } if (STRNCMP(arg, "