Mercurial > vim
changeset 31418:462508d04341 v9.0.1042
patch 9.0.1042: ASAN gives false alarm about array access.
Commit: https://github.com/vim/vim/commit/4ae0057308c59a0dee2b452736366e49a5a98b3a
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Dec 9 22:49:23 2022 +0000
patch 9.0.1042: ASAN gives false alarm about array access.
Problem: ASAN gives false alarm about array access.
Solution: Use an intermediate pointer.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 10 Dec 2022 00:00:03 +0100 |
parents | ed18fed96c8f |
children | 1696a3098ac4 |
files | src/version.c src/vim9class.c |
diffstat | 2 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/version.c +++ b/src/version.c @@ -696,6 +696,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1042, +/**/ 1041, /**/ 1040,
--- a/src/vim9class.c +++ b/src/vim9class.c @@ -441,7 +441,10 @@ class_object_index( for (int i = 0; i < cl->class_obj_method_count; ++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]; int argcount = 0;