]> granicus.if.org Git - vim/commitdiff
updated for version 7.3.040 v7.3.040
authorBram Moolenaar <Bram@vim.org>
Wed, 27 Oct 2010 11:37:44 +0000 (13:37 +0200)
committerBram Moolenaar <Bram@vim.org>
Wed, 27 Oct 2010 11:37:44 +0000 (13:37 +0200)
Problem:    Comparing strings while ignoring case goes beyond end of the
            string when there are illegal bytes. (Dominique Pelle)
Solution:   Explicitly check for illegal bytes.

src/mbyte.c
src/version.c

index 9c0b1879135565621a9d59a6ff472d0f12105ce3..61a7d8bd65ad0c5ed463d01a05cdfa40e5ffb32b 100644 (file)
@@ -3124,6 +3124,9 @@ mb_strnicmp(s1, s2, nn)
                /* If one of the two characters is incomplete return -1. */
                if (incomplete || i + utf_byte2len(s2[i]) > n)
                    return -1;
+               /* Don't case-fold illegal bytes or truncated characters. */
+               if (utf_ptr2len(s1 + i) < l || utf_ptr2len(s2 + i) < l)
+                   return -1;
                cdiff = utf_fold(utf_ptr2char(s1 + i))
                                             - utf_fold(utf_ptr2char(s2 + i));
                if (cdiff != 0)
index b334cdb1605389dd795a19da04330eb94ceaebf4..3285341ee423e2e6690e45bdee060e98fdcb559c 100644 (file)
@@ -714,6 +714,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    40,
 /**/
     39,
 /**/