Skip to content

Commit 5d3c671

Browse files
committed
updated for version 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.
1 parent c66757d commit 5d3c671

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

src/regexp.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4146,7 +4146,8 @@ regtry(prog, col)
41464146
{
41474147
/* Only accept single line matches. */
41484148
if (reg_startzpos[i].lnum >= 0
4149-
&& reg_endzpos[i].lnum == reg_startzpos[i].lnum)
4149+
&& reg_endzpos[i].lnum == reg_startzpos[i].lnum
4150+
&& reg_endzpos[i].col >= reg_startzpos[i].col)
41504151
re_extmatch_out->matches[i] =
41514152
vim_strnsave(reg_getline(reg_startzpos[i].lnum)
41524153
+ reg_startzpos[i].col,

src/regexp_nfa.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6781,8 +6781,10 @@ nfa_regtry(prog, col)
67816781
{
67826782
struct multipos *mpos = &subs.synt.list.multi[i];
67836783

6784-
/* Only accept single line matches. */
6785-
if (mpos->start.lnum >= 0 && mpos->start.lnum == mpos->end.lnum)
6784+
/* Only accept single line matches that are valid. */
6785+
if (mpos->start.lnum >= 0
6786+
&& mpos->start.lnum == mpos->end.lnum
6787+
&& mpos->end.col >= mpos->start.col)
67866788
re_extmatch_out->matches[i] =
67876789
vim_strnsave(reg_getline(mpos->start.lnum)
67886790
+ mpos->start.col,

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,8 @@ static char *(features[]) =
734734

735735
static int included_patches[] =
736736
{ /* Add new patch number below this line */
737+
/**/
738+
253,
737739
/**/
738740
252,
739741
/**/

0 commit comments

Comments
 (0)