Skip to content

Commit 4ae0057

Browse files
committed
patch 9.0.1042: ASAN gives false alarm about array access.
Problem: ASAN gives false alarm about array access. Solution: Use an intermediate pointer.
1 parent ffdaca9 commit 4ae0057

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,8 @@ static char *(features[]) =
695695

696696
static int included_patches[] =
697697
{ /* Add new patch number below this line */
698+
/**/
699+
1042,
698700
/**/
699701
1041,
700702
/**/

src/vim9class.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,10 @@ class_object_index(
441441
for (int i = 0; i < cl->class_obj_method_count; ++i)
442442
{
443443
ufunc_T *fp = cl->class_obj_methods[i];
444-
if (STRNCMP(name, fp->uf_name, len) == 0 && fp->uf_name[len] == NUL)
444+
// Use a separate pointer to avoid that ASAN complains about
445+
// uf_name[] only being 4 characters.
446+
char_u *ufname = (char_u *)fp->uf_name;
447+
if (STRNCMP(name, ufname, len) == 0 && ufname[len] == NUL)
445448
{
446449
typval_T argvars[MAX_FUNC_ARGS + 1];
447450
int argcount = 0;

0 commit comments

Comments
 (0)