mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Fix warnings: eval.c: dictitem_alloc(): Out-of-bounds access: FP.
Problem : Out-of-bound array access @ 5737. 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:
parent
d3f413ba6a
commit
be90cdf4f9
@ -5734,7 +5734,9 @@ dict_free (
|
|||||||
dictitem_T *dictitem_alloc(char_u *key) FUNC_ATTR_NONNULL_RET
|
dictitem_T *dictitem_alloc(char_u *key) FUNC_ATTR_NONNULL_RET
|
||||||
{
|
{
|
||||||
dictitem_T *di = xmalloc(sizeof(dictitem_T) + STRLEN(key));
|
dictitem_T *di = xmalloc(sizeof(dictitem_T) + STRLEN(key));
|
||||||
|
#ifndef __clang_analyzer__
|
||||||
STRCPY(di->di_key, key);
|
STRCPY(di->di_key, key);
|
||||||
|
#endif
|
||||||
di->di_flags = 0;
|
di->di_flags = 0;
|
||||||
return di;
|
return di;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user