diff options
author | Bram Moolenaar <Bram@vim.org> | 2008-06-29 14:16:06 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2008-06-29 14:16:06 +0000 |
commit | 89bf0927af4c8c3bbd2b9ae4558e0a581380d83f (patch) | |
tree | 15c82ecbbed213d7135add0c437c39a33e8b3805 | |
parent | 0d1498ea69faad513f7e55c74c220990f9d89996 (diff) | |
download | vim-git-89bf0927af4c8c3bbd2b9ae4558e0a581380d83f.tar.gz |
updated for version 7.2a-010v7.2a.010
-rw-r--r-- | src/mbyte.c | 19 | ||||
-rw-r--r-- | src/message.c | 2 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 19 insertions, 4 deletions
diff --git a/src/mbyte.c b/src/mbyte.c index 4e9059366..d6edf201e 100644 --- a/src/mbyte.c +++ b/src/mbyte.c @@ -1387,7 +1387,7 @@ utf_ptr2char(p) return p[0]; len = utf8len_tab[p[0]]; - if ((p[1] & 0xc0) == 0x80) + if (len > 1 && (p[1] & 0xc0) == 0x80) { if (len == 2) return ((p[0] & 0x1f) << 6) + (p[1] & 0x3f); @@ -1753,14 +1753,27 @@ utfc_ptr2len_len(p, size) #endif while (len < size) { - if (p[len] < 0x80 || !UTF_COMPOSINGLIKE(p + prevlen, p + len)) + int len_next_char; + + if (p[len] < 0x80) + break; + + /* + * Next character length should not go beyond size to ensure that + * UTF_COMPOSINGLIKE(...) does not read beyond size. + */ + len_next_char = utf_ptr2len_len(p + len, size - len); + if (len_next_char > size - len) + break; + + if (!UTF_COMPOSINGLIKE(p + prevlen, p + len)) break; /* Skip over composing char */ #ifdef FEAT_ARABIC prevlen = len; #endif - len += utf_ptr2len_len(p + len, size - len); + len += len_next_char; } return len; } diff --git a/src/message.c b/src/message.c index 66936cda3..cb749da7f 100644 --- a/src/message.c +++ b/src/message.c @@ -1391,7 +1391,7 @@ msg_outtrans_len_attr(msgstr, len, attr) plain_start = str + 1; msg_puts_attr(s, attr == 0 ? hl_attr(HLF_8) : attr); } - retval += ptr2cells(str); + retval += char2cells(*str); ++str; } } diff --git a/src/version.c b/src/version.c index d51c8777b..d44cd658e 100644 --- a/src/version.c +++ b/src/version.c @@ -677,6 +677,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 10, +/**/ 9, /**/ 8, |