kit/ChildSession.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
New commits: commit bb8fc2df43f572109d2ea1b89eebde0890f0d7c7 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Wed Oct 9 09:04:00 2019 +0200 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Wed Oct 9 09:05:32 2019 +0200 kit: fix UB in ChildSession::paste() Seen during unit-large-paste with log level set to trace: common/SpookyV2.h:139:13: runtime error: load of misaligned address 0x62500042b919 for type 'const uint64' (aka 'const unsigned long'), which requires 8 byte alignment 0x62500042b919: note: pointer points here 74 6d 6c 0a 63 37 30 30 66 36 39 33 61 32 61 62 35 66 36 62 39 33 64 65 64 61 63 36 31 31 66 39 ^ SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior common/SpookyV2.h:139:13 in Change-Id: I6f15421bcdead839dac85adae5da10f4b41c04d1 diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp index 7425e4fac..cd38ec7a7 100644 --- a/kit/ChildSession.cpp +++ b/kit/ChildSession.cpp @@ -1106,7 +1106,12 @@ bool ChildSession::paste(const char* buffer, int length, const std::vector<std:: { getLOKitDocument()->setView(_viewId); - LOG_TRC("Paste data of size " << size << " bytes and hash " << SpookyHash::Hash64(data, size, 0)); + if (Log::logger().trace()) + { + // Ensure 8 byte alignment for the start of the data, SpookyHash needs it. + std::vector<char> toHash(data, data + size); + LOG_TRC("Paste data of size " << size << " bytes and hash " << SpookyHash::Hash64(toHash.data(), toHash.size(), 0)); + } success = getLOKitDocument()->paste(mimeType.c_str(), data, size); if (!success) LOG_WRN("Paste failed " << getLOKitLastError()); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits