mirror of
https://github.com/neovim/neovim.git
synced 2025-09-15 07:48:18 +00:00
Fix warnings: eval.c: add_nr_var(): Out of bounds: FP.
Problem : Out-of-bound array access @ 18737. 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.
This commit is contained in:
@@ -18809,7 +18809,9 @@ free_funccal (
|
|||||||
*/
|
*/
|
||||||
static void add_nr_var(dict_T *dp, dictitem_T *v, char *name, varnumber_T nr)
|
static void add_nr_var(dict_T *dp, dictitem_T *v, char *name, varnumber_T nr)
|
||||||
{
|
{
|
||||||
|
#ifndef __clang_analyzer__
|
||||||
STRCPY(v->di_key, name);
|
STRCPY(v->di_key, name);
|
||||||
|
#endif
|
||||||
v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX;
|
v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX;
|
||||||
hash_add(&dp->dv_hashtab, DI2HIKEY(v));
|
hash_add(&dp->dv_hashtab, DI2HIKEY(v));
|
||||||
v->di_tv.v_type = VAR_NUMBER;
|
v->di_tv.v_type = VAR_NUMBER;
|
||||||
|
Reference in New Issue
Block a user