summaryrefslogtreecommitdiffstats
path: root/video/out/drm_common.c
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2024-02-26 04:55:00 +0100
committerDudemanguy <random342@airmail.cc>2024-02-28 16:04:02 +0000
commit0897604298120c3f197fa151ff85c9b5213c26f6 (patch)
tree2c38308dce99430528ddf1c0746441ac8cdb7c42 /video/out/drm_common.c
parentd955dfab294ecd24064f2d64b8af0bafc2af575c (diff)
downloadmpv-0897604298120c3f197fa151ff85c9b5213c26f6.tar.bz2
mpv-0897604298120c3f197fa151ff85c9b5213c26f6.tar.xz
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.
Diffstat (limited to 'video/out/drm_common.c')
-rw-r--r--video/out/drm_common.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/video/out/drm_common.c b/video/out/drm_common.c
index da45ca27a3..1669e249eb 100644
--- a/video/out/drm_common.c
+++ b/video/out/drm_common.c
@@ -65,8 +65,7 @@ static int drm_connector_opt_help(struct mp_log *log, const struct m_option *opt
static int drm_mode_opt_help(struct mp_log *log, const struct m_option *opt,
struct bstr name);
-static int drm_validate_mode_opt(struct mp_log *log, const struct m_option *opt,
- struct bstr name, const char **value);
+static OPT_STRING_VALIDATE_FUNC(drm_validate_mode_opt);
static void drm_show_available_modes(struct mp_log *log, const drmModeConnector *connector);