diff options
author | Kacper Michajłow <kasper93@gmail.com> | 2024-02-26 04:55:00 +0100 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2024-02-28 16:04:02 +0000 |
commit | 0897604298120c3f197fa151ff85c9b5213c26f6 (patch) | |
tree | 2c38308dce99430528ddf1c0746441ac8cdb7c42 /video/out/gpu/hwdec.h | |
parent | d955dfab294ecd24064f2d64b8af0bafc2af575c (diff) | |
download | mpv-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/gpu/hwdec.h')
-rw-r--r-- | video/out/gpu/hwdec.h | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/video/out/gpu/hwdec.h b/video/out/gpu/hwdec.h index 7766073e0c..f195606417 100644 --- a/video/out/gpu/hwdec.h +++ b/video/out/gpu/hwdec.h @@ -18,12 +18,8 @@ struct ra_hwdec_ctx { int num_hwdecs; }; -int ra_hwdec_validate_opt(struct mp_log *log, const m_option_t *opt, - struct bstr name, const char **value); - -int ra_hwdec_validate_drivers_only_opt(struct mp_log *log, - const m_option_t *opt, - struct bstr name, const char **value); +OPT_STRING_VALIDATE_FUNC(ra_hwdec_validate_opt); +OPT_STRING_VALIDATE_FUNC(ra_hwdec_validate_drivers_only_opt); void ra_hwdec_ctx_init(struct ra_hwdec_ctx *ctx, struct mp_hwdec_devices *devs, const char *opt, bool load_all_by_default); |