mirror of
https://github.com/neovim/neovim.git
synced 2025-10-07 02:16:31 +00:00
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)
15ee567809
This commit is contained in:
@@ -4184,7 +4184,7 @@ static int is_one_char(char_u *pattern, bool move, pos_T *cur,
|
|||||||
nmatched = vim_regexec_multi(®match, curwin, curbuf,
|
nmatched = vim_regexec_multi(®match, curwin, curbuf,
|
||||||
pos.lnum, regmatch.startpos[0].col,
|
pos.lnum, regmatch.startpos[0].col,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
if (!nmatched) {
|
if (nmatched != 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} while (direction == FORWARD
|
} 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].lnum == regmatch.endpos[0].lnum
|
||||||
&& regmatch.startpos[0].col == regmatch.endpos[0].col);
|
&& regmatch.startpos[0].col == regmatch.endpos[0].col);
|
||||||
// one char width
|
// 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;
|
result = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user