diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-10-19 11:57:34 -0400 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-10-19 11:59:09 -0400 |
commit | d27fc0825732d575109ce7d149164e86d7b2cb98 (patch) | |
tree | f5124f640776ce3220b407c24009597d1188a6ee /src | |
parent | 437fe261ab93e5b366fdcd095ccac7be1235b0eb (diff) | |
download | rneovim-d27fc0825732d575109ce7d149164e86d7b2cb98.tar.gz rneovim-d27fc0825732d575109ce7d149164e86d7b2cb98.tar.bz2 rneovim-d27fc0825732d575109ce7d149164e86d7b2cb98.zip |
vim-patch:8.1.2178: accessing uninitialized memory in test
Problem: Accessing uninitialized memory in test.
Solution: Check if there was a match before using the match position.
(Dominique Pelle, closes vim/vim#5088)
https://github.com/vim/vim/commit/15ee567809a9808693163dd7c357ef0c172ecc9e
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/search.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/nvim/search.c b/src/nvim/search.c index 1f382d31c5..fb31e76986 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -4184,7 +4184,7 @@ static int is_one_char(char_u *pattern, bool move, pos_T *cur, nmatched = vim_regexec_multi(®match, curwin, curbuf, pos.lnum, regmatch.startpos[0].col, NULL, NULL); - if (!nmatched) { + if (nmatched != 0) { break; } } while (direction == FORWARD @@ -4196,7 +4196,10 @@ static int is_one_char(char_u *pattern, bool move, pos_T *cur, && regmatch.startpos[0].lnum == regmatch.endpos[0].lnum && regmatch.startpos[0].col == regmatch.endpos[0].col); // one char width - if (!result && inc(&pos) >= 0 && pos.col == regmatch.endpos[0].col) { + if (!result + && nmatched != 0 + && inc(&pos) >= 0 + && pos.col == regmatch.endpos[0].col) { result = true; } } |