From 0cbcf88eaa01904b53b4606943de5fd34f9c5469 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Tue, 1 Aug 2023 17:52:39 +0200 Subject: [PATCH] pipewire: module-profiler: fix misaligned access Fix the following misaligned access that happens when `pw-top` is started: ../src/modules/module-profiler.c:144:5: runtime error: member access within misaligned address 0x7f7fa11fe8d9 for type 'struct spa_pod_struct', which requires 4 byte alignment 0x7f7fa11fe8d9: note: pointer points here 60 00 00 01 00 00 00 00 00 00 00 00 88 02 00 00 0f 00 00 00 0a 00 04 00 00 00 00 00 01 00 01 00 ^ #0 0x7f7fa64a65e1 in do_flush_event ../src/modules/module-profiler.c:144 #1 0x7f7fa36d658e in source_event_func ../spa/plugins/support/loop.c:650 #2 0x7f7fa36cfbab in loop_iterate ../spa/plugins/support/loop.c:483 #3 0x7f7fa80a71cd in pw_main_loop_run ../src/pipewire/main-loop.c:128 #4 0x55af46ff4722 in main ../src/daemon/pipewire.c:111 #5 0x7f7fa8a3984f (/usr/lib/libc.so.6+0x2384f) (BuildId: 2f005a79cd1a8e385972f5a102f16adba414d75e) #6 0x7f7fa8a39909 in __libc_start_main (/usr/lib/libc.so.6+0x23909) (BuildId: 2f005a79cd1a8e385972f5a102f16adba414d75e) #7 0x55af46ff32a4 in _start (src/daemon/pipewire+0x42a4) (BuildId: 2d6250e405f52fb86992fef8584ccfdfdb85569f) SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../src/modules/module-profiler.c:144:5 in --- src/modules/module-profiler.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/modules/module-profiler.c b/src/modules/module-profiler.c index 0dac145cd..f6eedbd24 100644 --- a/src/modules/module-profiler.c +++ b/src/modules/module-profiler.c @@ -4,6 +4,7 @@ #include #include +#include #include #include #include @@ -103,6 +104,7 @@ struct impl { struct spa_source *flush_event; unsigned int listening:1; + alignas(max_align_t) uint8_t flush[FLUSH_BUFFER + sizeof(struct spa_pod_struct)]; };