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
This commit is contained in:
Marco Hinz 2014-04-14 17:19:27 +02:00 committed by Thiago de Arruda
parent cb0adf60de
commit b94239e03c
3 changed files with 14 additions and 10 deletions

View File

@ -3665,11 +3665,14 @@ static long regtry(bt_regprog_T *prog, colnr_T col)
if (REG_MULTI) { if (REG_MULTI) {
/* Only accept single line matches. */ /* Only accept single line matches. */
if (reg_startzpos[i].lnum >= 0 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] = re_extmatch_out->matches[i] =
vim_strnsave(reg_getline(reg_startzpos[i].lnum) vim_strnsave(reg_getline(reg_startzpos[i].lnum)
+ reg_startzpos[i].col, + reg_startzpos[i].col,
reg_endzpos[i].col - reg_startzpos[i].col); reg_endzpos[i].col
- reg_startzpos[i].col);
}
} else { } else {
if (reg_startzp[i] != NULL && reg_endzp[i] != NULL) if (reg_startzp[i] != NULL && reg_endzp[i] != NULL)
re_extmatch_out->matches[i] = re_extmatch_out->matches[i] =

View File

@ -6121,12 +6121,14 @@ static long nfa_regtry(nfa_regprog_T *prog, colnr_T col)
if (REG_MULTI) { if (REG_MULTI) {
struct multipos *mpos = &subs.synt.list.multi[i]; struct multipos *mpos = &subs.synt.list.multi[i];
/* Only accept single line matches. */ // Only accept single line matches that are valid.
if (mpos->start.lnum >= 0 && mpos->start.lnum == mpos->end.lnum) if (mpos->start.lnum >= 0
&& mpos->start.lnum == mpos->end.lnum
&& mpos->end.col >= mpos->start.col) {
re_extmatch_out->matches[i] = re_extmatch_out->matches[i] =
vim_strnsave(reg_getline(mpos->start.lnum) vim_strnsave(reg_getline(mpos->start.lnum) + mpos->start.col,
+ mpos->start.col, mpos->end.col - mpos->start.col);
mpos->end.col - mpos->start.col); }
} else { } else {
struct linepos *lpos = &subs.synt.list.line[i]; struct linepos *lpos = &subs.synt.list.line[i];

View File

@ -207,7 +207,7 @@ static int included_patches[] = {
//256, //256,
//255, //255,
//254, //254,
//253, 253,
//252, //252,
251, 251,
//250, //250,
@ -220,7 +220,6 @@ static int included_patches[] = {
//243, //243,
//242, //242,
//241, //241,
//240,
240, 240,
239, 239,
//238, //238,