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

patch 9.0.1913: if_python: undefined behaviour for function pointers

Problem:  if_python: undefined behaviour for function pointers
Solution: Fix if_python undefined behavior for function pointer casts

Identified by clang 17 UBSAN (see #12745). Make sure to cast function
pointers with the same signature only.

closes: #13122

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
This commit is contained in:
Yee Cheng Chin
2023-09-19 20:30:22 +02:00
committed by Christian Brabandt
parent 6f00d17e8d
commit 2ce070c27a
4 changed files with 13 additions and 10 deletions

View File

@@ -1103,7 +1103,7 @@ ex_python(exarg_T *eap)
p_pyx = 2;
DoPyCommand(script == NULL ? (char *) eap->arg : (char *) script,
(rangeinitializer) init_range_cmd,
init_range_cmd,
(runner) run_cmd,
(void *) eap);
}
@@ -1154,7 +1154,7 @@ ex_pyfile(exarg_T *eap)
// Execute the file
DoPyCommand(buffer,
(rangeinitializer) init_range_cmd,
init_range_cmd,
(runner) run_cmd,
(void *) eap);
}
@@ -1166,7 +1166,7 @@ ex_pydo(exarg_T *eap)
p_pyx = 2;
DoPyCommand((char *)eap->arg,
(rangeinitializer) init_range_cmd,
init_range_cmd,
(runner)run_do,
(void *)eap);
}
@@ -1524,7 +1524,7 @@ FunctionGetattr(PyObject *self, char *name)
do_pyeval(char_u *str, typval_T *rettv)
{
DoPyCommand((char *) str,
(rangeinitializer) init_range_eval,
init_range_eval,
(runner) run_eval,
(void *) rettv);
if (rettv->v_type == VAR_UNKNOWN)