changeset 6723:eefee03a37fe v7.4.685

updated for version 7.4.685 Problem: When there are illegal utf-8 characters the old regexp engine may go past the end of a string. Solution: Only advance to the end of the string. (Dominique Pelle)
author Bram Moolenaar <bram@vim.org>
date Tue, 31 Mar 2015 14:17:31 +0200
parents 81f0b85eb236
children 635544d02ef6
files src/regexp.c src/version.c
diffstat 2 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -4782,7 +4782,8 @@ regmatch(scan)
 		    /* When only a composing char is given match at any
 		     * position where that composing char appears. */
 		    status = RA_NOMATCH;
-		    for (i = 0; reginput[i] != NUL; i += utf_char2len(inpc))
+		    for (i = 0; reginput[i] != NUL;
+						i += utf_ptr2len(reginput + i))
 		    {
 			inpc = mb_ptr2char(reginput + i);
 			if (!utf_iscomposing(inpc))
--- a/src/version.c
+++ b/src/version.c
@@ -742,6 +742,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    685,
+/**/
     684,
 /**/
     683,