0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 9.0.1042: ASAN gives false alarm about array access.

Problem:    ASAN gives false alarm about array access.
Solution:   Use an intermediate pointer.
This commit is contained in:
Bram Moolenaar
2022-12-09 22:49:23 +00:00
parent ffdaca9e6f
commit 4ae0057308
2 changed files with 6 additions and 1 deletions

View File

@@ -695,6 +695,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1042,
/**/ /**/
1041, 1041,
/**/ /**/

View File

@@ -441,7 +441,10 @@ class_object_index(
for (int i = 0; i < cl->class_obj_method_count; ++i) for (int i = 0; i < cl->class_obj_method_count; ++i)
{ {
ufunc_T *fp = cl->class_obj_methods[i]; ufunc_T *fp = cl->class_obj_methods[i];
if (STRNCMP(name, fp->uf_name, len) == 0 && fp->uf_name[len] == NUL) // Use a separate pointer to avoid that ASAN complains about
// uf_name[] only being 4 characters.
char_u *ufname = (char_u *)fp->uf_name;
if (STRNCMP(name, ufname, len) == 0 && ufname[len] == NUL)
{ {
typval_T argvars[MAX_FUNC_ARGS + 1]; typval_T argvars[MAX_FUNC_ARGS + 1];
int argcount = 0; int argcount = 0;