From db20edef69aa3766ff7d7845ec54a894d686f8c0 Mon Sep 17 00:00:00 2001 From: watiko Date: Wed, 17 Feb 2016 02:22:46 +0900 Subject: vim-patch:7.4.937 Problem: Segfault reading unitialized memory. Solution: Do not read match \z0, it does not exist. (Marius Gedminas, closes vim/vim#497) https://github.com/vim/vim/commit/5ad075c0735d3d8b97708d17c22de8facb15f997 --- src/nvim/regexp_nfa.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/nvim/regexp_nfa.c') diff --git a/src/nvim/regexp_nfa.c b/src/nvim/regexp_nfa.c index dd41535110..e2849fb17a 100644 --- a/src/nvim/regexp_nfa.c +++ b/src/nvim/regexp_nfa.c @@ -6180,7 +6180,8 @@ static long nfa_regtry(nfa_regprog_T *prog, colnr_T col) if (prog->reghasz == REX_SET) { cleanup_zsubexpr(); re_extmatch_out = make_extmatch(); - for (i = 0; i < subs.synt.in_use; i++) { + // Loop over \z1, \z2, etc. There is no \z0. + for (i = 1; i < subs.synt.in_use; i++) { if (REG_MULTI) { struct multipos *mpos = &subs.synt.list.multi[i]; -- cgit