# HG changeset patch # User Christian Brabandt # Date 1461412805 -7200 # Node ID 42beb54724faeece49399d13a05fb8b7d11091ec # Parent dd79f120c9d5cbeedd0b07756e5935625c1084af commit https://github.com/vim/vim/commit/73dfe917ba6357413aaf98a021c91add5ac6e9bc Author: Bram Moolenaar Date: Sat Apr 23 13:54:48 2016 +0200 patch 7.4.1779 Problem: Using negative index in strcharpart(). (Yegappan Lakshmanan) Solution: Assume single byte when using a negative iindex. diff --git a/src/eval.c b/src/eval.c --- a/src/eval.c +++ b/src/eval.c @@ -19774,7 +19774,12 @@ f_strcharpart(typval_T *argvars, typval_ charlen = get_tv_number(&argvars[2]); while (charlen > 0 && nbyte + len < slen) { - len += mb_char2len(p[nbyte + len]); + int off = nbyte + len; + + if (off < 0) + len += 1; + else + len += mb_char2len(p[off]); --charlen; } } diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -754,6 +754,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1779, +/**/ 1778, /**/ 1777,