From 42731a9a154c991706b8b5816fbdf5d31726cd97 Mon Sep 17 00:00:00 2001 From: Jurica Bradaric Date: Sun, 18 Sep 2016 21:23:23 +0200 Subject: vim-patch:7.4.1648 Problem: Compiler has a problem copying a string into di_key[]. (Yegappan Lakshmanan) Solution: Add dictitem16_T. https://github.com/vim/vim/commit/bee6c0cf86a75faa2aa893f2c9db82fd944a89a5 --- src/nvim/eval.c | 5 ++--- src/nvim/eval_defs.h | 10 ++++++++++ src/nvim/version.c | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 7d7aea83af..045ca22e16 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -292,8 +292,8 @@ typedef enum { .vv_di = { \ .di_tv = { .v_type = type }, \ .di_flags = 0, \ + .di_key = { 0 }, \ }, \ - .vv_filler = { 0 }, \ .vv_flags = flags, \ } @@ -303,8 +303,7 @@ typedef enum { // variables with the VV_ defines. static struct vimvar { char *vv_name; ///< Name of the variable, without v:. - dictitem_T vv_di; ///< Value of the variable, with name. - char vv_filler[16]; ///< Space for longest name from below. + dictitem16_T vv_di; ///< Value and name for key (max 16 chars) char vv_flags; ///< Flags: #VV_COMPAT, #VV_RO, #VV_RO_SBX. } vimvars[] = { diff --git a/src/nvim/eval_defs.h b/src/nvim/eval_defs.h index 884c987f10..91d544074f 100644 --- a/src/nvim/eval_defs.h +++ b/src/nvim/eval_defs.h @@ -114,6 +114,16 @@ struct dictitem_S { typedef struct dictitem_S dictitem_T; +/// A dictitem with a 16 character key (plus NUL) +struct dictitem16_S { + typval_T di_tv; ///< type and value of the variable + char_u di_flags; ///< flags (only used for variable) + char_u di_key[17]; ///< key +}; + +typedef struct dictitem16_S dictitem16_T; + + #define DI_FLAGS_RO 1 // "di_flags" value: read-only variable #define DI_FLAGS_RO_SBX 2 // "di_flags" value: read-only in the sandbox #define DI_FLAGS_FIX 4 // "di_flags" value: fixed: no :unlet or remove() diff --git a/src/nvim/version.c b/src/nvim/version.c index 3f11c7e860..0f939ad1f4 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -795,7 +795,7 @@ static int included_patches[] = { // 1651 NA // 1650, 1649, - // 1648, + 1648, // 1647, // 1646 NA // 1645, -- cgit From 75314101691a86575fb7d7b1b2931a5dfe7e14e2 Mon Sep 17 00:00:00 2001 From: Jurica Bradaric Date: Sun, 18 Sep 2016 17:43:15 +0200 Subject: vim-patch:7.4.1679 Problem: Coverity: copying value of v_lock without initializing it. Solution: Init v_lock in rettv_list_alloc() and rettv_dict_alloc(). https://github.com/vim/vim/commit/7d2a5796d39905a972e8f74af5f7b0a62e3de173 --- src/nvim/eval.c | 6 ++++-- src/nvim/version.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 045ca22e16..5c6c66ade1 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -4951,7 +4951,8 @@ static list_T *rettv_list_alloc(typval_T *rettv) list_T *l = list_alloc(); rettv->vval.v_list = l; rettv->v_type = VAR_LIST; - ++l->lv_refcount; + rettv->v_lock = VAR_UNLOCKED; + l->lv_refcount++; return l; } @@ -6131,7 +6132,8 @@ static void rettv_dict_alloc(typval_T *rettv) rettv->vval.v_dict = d; rettv->v_type = VAR_DICT; - ++d->dv_refcount; + rettv->v_lock = VAR_UNLOCKED; + d->dv_refcount++; } /// Clear all the keys of a Dictionary. "d" remains a valid empty Dictionary. diff --git a/src/nvim/version.c b/src/nvim/version.c index 0f939ad1f4..d6a6587135 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -764,7 +764,7 @@ static int included_patches[] = { 1682, // 1681, // 1680 NA - // 1679, + 1679, // 1678 NA // 1677 NA 1676, -- cgit From b0aa748e1463f78eadebc119a09ada0e25c13e6b Mon Sep 17 00:00:00 2001 From: Jurica Bradaric Date: Sun, 18 Sep 2016 17:44:45 +0200 Subject: vim-patch:7.4.1681 Problem: Coverity warns for fixed size buffer length (false positive). Solution: Add a check for the name length. https://github.com/vim/vim/commit/ef9d9b94a8803c405884bb6914ed745ede57c596 --- src/nvim/eval.c | 1 + src/nvim/version.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 5c6c66ade1..b05b4c4f7e 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -513,6 +513,7 @@ void eval_init(void) for (size_t i = 0; i < ARRAY_SIZE(vimvars); i++) { p = &vimvars[i]; + assert(STRLEN(p->vv_name) <= 16); STRCPY(p->vv_di.di_key, p->vv_name); if (p->vv_flags & VV_RO) p->vv_di.di_flags = DI_FLAGS_RO | DI_FLAGS_FIX; diff --git a/src/nvim/version.c b/src/nvim/version.c index d6a6587135..302e78cb6c 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -762,7 +762,7 @@ static int included_patches[] = { // 1684 NA // 1683 NA 1682, - // 1681, + 1681, // 1680 NA 1679, // 1678 NA -- cgit