From 381ed415fc185fa5314b60b3294cfe494bd40a80 Mon Sep 17 00:00:00 2001 From: Sergey Markelov Date: Tue, 6 Aug 2024 15:01:11 -0700 Subject: [PATCH] Fix UBSAN reported access to kernel_dirent withing misaligned address This is can be an issue on ARM, it can cause a hang of CrashReportTest.MiniDump test on macOS. --- src/client/linux/minidump_writer/directory_reader.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/client/linux/minidump_writer/directory_reader.h b/src/client/linux/minidump_writer/directory_reader.h index 62bba8779..eb1696943 100644 --- a/src/client/linux/minidump_writer/directory_reader.h +++ b/src/client/linux/minidump_writer/directory_reader.h @@ -95,9 +95,10 @@ class DirectoryReader { private: const int fd_; - bool hit_eof_; unsigned buf_used_; - uint8_t buf_[sizeof(struct kernel_dirent) + NAME_MAX + 1]; + alignas(struct kernel_dirent) + uint8_t buf_[sizeof(struct kernel_dirent) + NAME_MAX + 1]; + bool hit_eof_; }; } // namespace google_breakpad