To: vim_dev@googlegroups.com Subject: Patch 7.4.1052 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.1052 Problem: Illegal memory access with weird syntax command. (Dominique Pelle) Solution: Check for column past end of line. Files: src/syntax.c *** ../vim-7.4.1051/src/syntax.c 2016-01-02 22:02:56.201651969 +0100 --- src/syntax.c 2016-01-05 20:45:54.772825429 +0100 *************** *** 3022,3027 **** --- 3022,3029 ---- if (r && regmatch.startpos[0].col <= best_regmatch.startpos[0].col) { + int line_len; + /* Add offset to skip pattern match */ syn_add_end_off(&pos, ®match, spp_skip, SPO_ME_OFF, 1); *************** *** 3031,3036 **** --- 3033,3039 ---- break; line = ml_get_buf(syn_buf, startpos->lnum, FALSE); + line_len = (int)STRLEN(line); /* take care of an empty match or negative offset */ if (pos.col <= matchcol) *************** *** 3040,3051 **** else /* Be careful not to jump over the NUL at the end-of-line */ for (matchcol = regmatch.endpos[0].col; ! line[matchcol] != NUL && matchcol < pos.col; ++matchcol) ; /* if the skip pattern includes end-of-line, break here */ ! if (line[matchcol] == NUL) break; continue; /* start with first end pattern again */ --- 3043,3054 ---- else /* Be careful not to jump over the NUL at the end-of-line */ for (matchcol = regmatch.endpos[0].col; ! matchcol < line_len && matchcol < pos.col; ++matchcol) ; /* if the skip pattern includes end-of-line, break here */ ! if (matchcol >= line_len) break; continue; /* start with first end pattern again */ *** ../vim-7.4.1051/src/version.c 2016-01-04 22:05:08.854156424 +0100 --- src/version.c 2016-01-05 20:42:38.970960255 +0100 *************** *** 743,744 **** --- 743,746 ---- { /* Add new patch number below this line */ + /**/ + 1052, /**/ -- Every exit is an entrance into something else. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///