aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/cbs_sei.h
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2024-02-25 02:16:27 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2024-02-25 13:42:47 +0100
commitab2173c0a530622a0e8683cbd66f8e5aff7a2916 (patch)
tree274f252c3a82775893b4b67548434d01108c1462 /libavcodec/cbs_sei.h
parentb4b8b9ad5cf8506f4c5abdc5c4cd5bb4f7285cdd (diff)
downloadffmpeg-ab2173c0a530622a0e8683cbd66f8e5aff7a2916.tar.gz
avcodec/cbs_h2645: Avoid function pointer casts, fix UB
The SEI message read/write functions are called via function pointers where the SEI message-specific context is passed as void*. But the actual function definitions use a pointer to their proper context in place of void*, making the calls undefined behaviour. Clang UBSan 17 warns about this. This commit fixes this by adding wrapper functions (created via macros) that have the right type that call the actual functions. This reduced the number of failing FATE tests with UBSan from 164 to 85 here. Reviewed-by: Mark Thompson <sw@jkqxz.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/cbs_sei.h')
-rw-r--r--libavcodec/cbs_sei.h7
1 files changed, 0 insertions, 7 deletions
diff --git a/libavcodec/cbs_sei.h b/libavcodec/cbs_sei.h
index 4511c506cc..ec7cdb62f0 100644
--- a/libavcodec/cbs_sei.h
+++ b/libavcodec/cbs_sei.h
@@ -126,13 +126,6 @@ typedef struct SEIMessageTypeDescriptor {
SEIMessageWriteFunction write;
} SEIMessageTypeDescriptor;
-// Macro for the read/write pair. The clumsy cast is needed because the
-// current pointer is typed in all of the read/write functions but has to
-// be void here to fit all cases.
-#define SEI_MESSAGE_RW(codec, name) \
- .read = (SEIMessageReadFunction) cbs_ ## codec ## _read_ ## name, \
- .write = (SEIMessageWriteFunction)cbs_ ## codec ## _write_ ## name
-
// End-of-list sentinel element.
#define SEI_MESSAGE_TYPE_END { .type = -1 }