aboutsummaryrefslogtreecommitdiff
path: root/src/regexp.c
diff options
context:
space:
mode:
authorMarco Hinz <mh.codebro@gmail.com>2014-04-14 17:19:27 +0200
committerThiago de Arruda <tpadilha84@gmail.com>2014-04-16 09:48:50 -0300
commitb94239e03c9713c784267972c8b2a90192314556 (patch)
tree88c5baa244bcda31c29d032ec761c6b932096798 /src/regexp.c
parentcb0adf60de98003564105169dee4bc792c56a559 (diff)
downloadrneovim-b94239e03c9713c784267972c8b2a90192314556.tar.gz
rneovim-b94239e03c9713c784267972c8b2a90192314556.tar.bz2
rneovim-b94239e03c9713c784267972c8b2a90192314556.zip
vim-patch:7.4.253
Problem: Crash when using cpp syntax file with pattern using external match. (Havard Garnes) Solution: Discard match when end column is before start column. https://code.google.com/p/vim/source/detail?r=4901a36479f200b2e6700ad91c26911d92deb886
Diffstat (limited to 'src/regexp.c')
-rw-r--r--src/regexp.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/regexp.c b/src/regexp.c
index 289e64cf2c..9120c8b097 100644
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -3665,11 +3665,14 @@ static long regtry(bt_regprog_T *prog, colnr_T col)
if (REG_MULTI) {
/* Only accept single line matches. */
if (reg_startzpos[i].lnum >= 0
- && reg_endzpos[i].lnum == reg_startzpos[i].lnum)
+ && reg_endzpos[i].lnum == reg_startzpos[i].lnum
+ && reg_endzpos[i].col >= reg_startzpos[i].col) {
re_extmatch_out->matches[i] =
vim_strnsave(reg_getline(reg_startzpos[i].lnum)
- + reg_startzpos[i].col,
- reg_endzpos[i].col - reg_startzpos[i].col);
+ + reg_startzpos[i].col,
+ reg_endzpos[i].col
+ - reg_startzpos[i].col);
+ }
} else {
if (reg_startzp[i] != NULL && reg_endzp[i] != NULL)
re_extmatch_out->matches[i] =