Problem: Clipboard regexp might be used recursively.
Solution: Check for recursive use and bail out.
if (x_no_connect)
return FALSE;
- /* Check for a match with "exclude:" from 'clipboard'. */
+ // Check for a match with "exclude:" from 'clipboard'.
if (clip_exclude_prog != NULL)
{
+ // Just in case we get called recursively, return FALSE. This could
+ // happen if vpeekc() is used while executing the prog and it causes a
+ // related callback to be invoked.
+ if (regprog_in_use(clip_exclude_prog))
+ return FALSE;
+
if (vim_regexec_prog(&clip_exclude_prog, FALSE, T_NAME, (colnr_T)0))
return FALSE;
}
list_T *reg_submatch_list(int no);
regprog_T *vim_regcomp(char_u *expr_arg, int re_flags);
void vim_regfree(regprog_T *prog);
+int regprog_in_use(regprog_T *prog);
int vim_regexec_prog(regprog_T **prog, int ignore_case, char_u *line, colnr_T col);
int vim_regexec(regmatch_T *rmp, char_u *line, colnr_T col);
int vim_regexec_nl(regmatch_T *rmp, char_u *line, colnr_T col);
}
#endif
+/*
+ * Return whether "prog" is currently being executed.
+ */
+ int
+regprog_in_use(regprog_T *prog)
+{
+ return prog->re_in_use;
+}
+
/*
* Match a regexp against a string.
* "rmp->regprog" is a compiled regexp as returned by vim_regcomp().
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 661,
/**/
660,
/**/