From 54973477e7a7cc8f955d1755d3243e7f89461e34 Mon Sep 17 00:00:00 2001 From: Chiu-Hsiang Hsu Date: Fri, 31 Jul 2015 02:18:18 +0800 Subject: [PATCH] vim-patch:7.4.799 Problem: Accessing memory before an allocated block. Solution: Check for not going before the start of a pattern. (Dominique Pelle) https://github.com/vim/vim/commit/v7-4-799 --- src/nvim/fileio.c | 11 +++++++---- src/nvim/version.c | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index 70cdac7947..7689b750c5 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -5749,16 +5749,19 @@ static int do_autocmd_event(event_T event, char_u *pat, int nested, char_u *cmd, * Find end of the pattern. * Watch out for a comma in braces, like "*.\{obj,o\}". */ + endpat = pat; + // ignore single comma + if (*endpat == ',') { + continue; + } brace_level = 0; - for (endpat = pat; *endpat && (*endpat != ',' || brace_level - || endpat[-1] == '\\'); ++endpat) { + for (; *endpat && (*endpat != ',' || brace_level || endpat[-1] == '\\'); + ++endpat) { if (*endpat == '{') brace_level++; else if (*endpat == '}') brace_level--; } - if (pat == endpat) /* ignore single comma */ - continue; patlen = (int)(endpat - pat); /* diff --git a/src/nvim/version.c b/src/nvim/version.c index c79c9d0f38..439292d0d6 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -98,7 +98,7 @@ static int included_patches[] = { //802, //801, //800, - //799, + 799, //798, //797, //796,