From 0897604298120c3f197fa151ff85c9b5213c26f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Mon, 26 Feb 2024 04:55:00 +0100 Subject: various: avoid function pointer casts The opt validator functions are casted to generic validator, which has erased type for value. Calling function by pointer of different definition is an UB. Avoid that by generating wrapper function that does proper argument type conversion and calls validator function. Type erased functions have mangled type in the name. Fixes UBSAN failures on Clang 17, which enabled fsanitize=function by default. --- video/out/vulkan/context.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'video/out/vulkan/context.c') diff --git a/video/out/vulkan/context.c b/video/out/vulkan/context.c index 5087403ade..f04895a2ae 100644 --- a/video/out/vulkan/context.c +++ b/video/out/vulkan/context.c @@ -37,8 +37,7 @@ struct vulkan_opts { bool async_compute; }; -static int vk_validate_dev(struct mp_log *log, const struct m_option *opt, - struct bstr name, const char **value) +static inline OPT_STRING_VALIDATE_FUNC(vk_validate_dev) { struct bstr param = bstr0(*value); int ret = M_OPT_INVALID; -- cgit v1.2.3