diff options
author | Eliseo Martínez <eliseomarmol@gmail.com> | 2014-11-17 10:39:40 +0100 |
---|---|---|
committer | Eliseo Martínez <eliseomarmol@gmail.com> | 2014-11-18 22:00:02 +0100 |
commit | 3bf32fe43f86a2c966c77b130f7ea7c71b6ac099 (patch) | |
tree | 0509747edef6afbb00fc615baa21a7aa15be2746 | |
parent | 34a4a01e4efb690743de0fe60d98a3ebed1bd681 (diff) | |
download | rneovim-3bf32fe43f86a2c966c77b130f7ea7c71b6ac099.tar.gz rneovim-3bf32fe43f86a2c966c77b130f7ea7c71b6ac099.tar.bz2 rneovim-3bf32fe43f86a2c966c77b130f7ea7c71b6ac099.zip |
Fix warnings: eval.c: call_user_func(): Out of bounds: FP.
Problem : Out-of-bound array access @ 18429.
Diagnostic : False positive.
Rationale : Situation is intentional. `dictitem_T` is a prefix all dict
items whill share, but actual size of each item will be
different depending on its key length. `di_key` array field
is declared of size 1 just to have a field name, but real
size will vary for each item.
Resolution : Make analyzer ignore it.
This could be refactored to use C99-allowed variable length
arrays, but eval.c is bound to dissappear, so no effort is
done in that sense.
-rw-r--r-- | src/nvim/eval.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index af7a2d0118..d2ab8aa6ee 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -18496,8 +18496,10 @@ call_user_func ( /* Set l:self to "selfdict". Use "name" to avoid a warning from * some compiler that checks the destination size. */ v = &fc->fixvar[fixvar_idx++].var; +#ifndef __clang_analyzer__ name = v->di_key; STRCPY(name, "self"); +#endif v->di_flags = DI_FLAGS_RO + DI_FLAGS_FIX; hash_add(&fc->l_vars.dv_hashtab, DI2HIKEY(v)); v->di_tv.v_type = VAR_DICT; @@ -18517,8 +18519,10 @@ call_user_func ( /* Use "name" to avoid a warning from some compiler that checks the * destination size. */ v = &fc->fixvar[fixvar_idx++].var; +#ifndef __clang_analyzer__ name = v->di_key; STRCPY(name, "000"); +#endif v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX; hash_add(&fc->l_avars.dv_hashtab, DI2HIKEY(v)); v->di_tv.v_type = VAR_LIST; |