diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-10-19 14:35:02 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-10-19 14:35:02 +0200 |
commit | 15ee567809a9808693163dd7c357ef0c172ecc9e (patch) | |
tree | 671f35bb6a72040d2427b518da6d96db4d43436a /src | |
parent | afbdb905c37675851e79d21239f502cd8e4ced9e (diff) | |
download | vim-git-15ee567809a9808693163dd7c357ef0c172ecc9e.tar.gz |
patch 8.1.2178: accessing uninitialized memory in testv8.1.2178
Problem: Accessing uninitialized memory in test.
Solution: Check if there was a match before using the match position.
(Dominique Pelle, closes #5088)
Diffstat (limited to 'src')
-rw-r--r-- | src/search.c | 7 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/search.c b/src/search.c index 91f53c606..ab0edc48b 100644 --- a/src/search.c +++ b/src/search.c @@ -4877,7 +4877,7 @@ is_one_char(char_u *pattern, int move, pos_T *cur, int direction) regmatch.startpos[0].col++; nmatched = vim_regexec_multi(®match, curwin, curbuf, pos.lnum, regmatch.startpos[0].col, NULL, NULL); - if (!nmatched) + if (nmatched != 0) break; } while (direction == FORWARD ? regmatch.startpos[0].col < pos.col : regmatch.startpos[0].col > pos.col); @@ -4887,8 +4887,9 @@ is_one_char(char_u *pattern, int move, pos_T *cur, int direction) result = (nmatched != 0 && 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) + // one char width + if (!result && nmatched != 0 + && inc(&pos) >= 0 && pos.col == regmatch.endpos[0].col) result = TRUE; } } diff --git a/src/version.c b/src/version.c index f96160e63..6a58b3db0 100644 --- a/src/version.c +++ b/src/version.c @@ -742,6 +742,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 2178, +/**/ 2177, /**/ 2176, |