@@ -1600,7 +1600,7 @@ nfa_regatom(void)
16001600
16011601 default :
16021602 {
1603- int n = 0 ;
1603+ long n = 0 ;
16041604 int cmp = c ;
16051605
16061606 if (c == '<' || c == '>' )
@@ -1628,7 +1628,14 @@ nfa_regatom(void)
16281628 /* \%{n}v \%{n}<v \%{n}>v */
16291629 EMIT (cmp == '<' ? NFA_VCOL_LT :
16301630 cmp == '>' ? NFA_VCOL_GT : NFA_VCOL );
1631- EMIT (n );
1631+ #if VIM_SIZEOF_INT < VIM_SIZEOF_LONG
1632+ if (n > INT_MAX )
1633+ {
1634+ EMSG (_ ("E951: \\% value too large" ));
1635+ return FAIL ;
1636+ }
1637+ #endif
1638+ EMIT ((int )n );
16321639 break ;
16331640 }
16341641 else if (c == '\'' && n == 0 )
@@ -3970,7 +3977,7 @@ static int nfa_match;
39703977#ifdef FEAT_RELTIME
39713978static proftime_T * nfa_time_limit ;
39723979static int * nfa_timed_out ;
3973- static int nfa_time_count ;
3980+ static int nfa_time_count ;
39743981#endif
39753982
39763983static void copy_pim (nfa_pim_T * to , nfa_pim_T * from );
@@ -4068,10 +4075,10 @@ copy_ze_off(regsub_T *to, regsub_T *from)
40684075 if (REG_MULTI )
40694076 {
40704077 if (from -> list .multi [0 ].end_lnum >= 0 )
4071- {
4078+ {
40724079 to -> list .multi [0 ].end_lnum = from -> list .multi [0 ].end_lnum ;
40734080 to -> list .multi [0 ].end_col = from -> list .multi [0 ].end_col ;
4074- }
4081+ }
40754082 }
40764083 else
40774084 {
@@ -5124,9 +5131,9 @@ recursive_regmatch(
51245131 }
51255132
51265133 if (state -> c == NFA_START_INVISIBLE_BEFORE
5127- || state -> c == NFA_START_INVISIBLE_BEFORE_FIRST
5128- || state -> c == NFA_START_INVISIBLE_BEFORE_NEG
5129- || state -> c == NFA_START_INVISIBLE_BEFORE_NEG_FIRST )
5134+ || state -> c == NFA_START_INVISIBLE_BEFORE_FIRST
5135+ || state -> c == NFA_START_INVISIBLE_BEFORE_NEG
5136+ || state -> c == NFA_START_INVISIBLE_BEFORE_NEG_FIRST )
51305137 {
51315138 /* The recursive match must end at the current position. When "pim" is
51325139 * not NULL it specifies the current position. */
@@ -6302,7 +6309,7 @@ nfa_regmatch(
63026309 }
63036310 }
63046311 else if (state -> c < 0 ? check_char_class (state -> c , curc )
6305- : (curc == state -> c
6312+ : (curc == state -> c
63066313 || (rex .reg_ic && MB_TOLOWER (curc )
63076314 == MB_TOLOWER (state -> c ))))
63086315 {
@@ -6863,7 +6870,7 @@ nfa_regmatch(
68636870 && (REG_MULTI
68646871 ? (reglnum < nfa_endp -> se_u .pos .lnum
68656872 || (reglnum == nfa_endp -> se_u .pos .lnum
6866- && (int )(reginput - regline )
6873+ && (int )(reginput - regline )
68676874 < nfa_endp -> se_u .pos .col ))
68686875 : reginput < nfa_endp -> se_u .ptr ))))
68696876 {
0 commit comments