https://github.com/c-rhodes updated https://github.com/llvm/llvm-project/pull/177907
>From 6d994d8bf614ffcee0ec491eb80a479cc884f633 Mon Sep 17 00:00:00 2001 From: Nikita Popov <[email protected]> Date: Fri, 23 Jan 2026 22:10:09 +0100 Subject: [PATCH] [MC] Try to fix ubsan bot Check that the size is non-zero to make sure we don't call memcpy with null pointers. This is well-defined now, but ubsan may still warn about it. (cherry picked from commit d064f395af7ac226dec3f8e90516a26e96e2acf1) --- llvm/lib/MC/MCObjectStreamer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/llvm/lib/MC/MCObjectStreamer.cpp b/llvm/lib/MC/MCObjectStreamer.cpp index 5fd30eccb45c5..0c64d89d7b491 100644 --- a/llvm/lib/MC/MCObjectStreamer.cpp +++ b/llvm/lib/MC/MCObjectStreamer.cpp @@ -111,7 +111,8 @@ void MCObjectStreamer::appendContents(ArrayRef<char> Contents) { assert(FragSpace >= Contents.size()); // As this is performance-sensitive code, explicitly use std::memcpy. // Optimization of std::copy to memmove is unreliable. - std::memcpy(getCurFragEnd(), Contents.begin(), Contents.size()); + if (!Contents.empty()) + std::memcpy(getCurFragEnd(), Contents.begin(), Contents.size()); CurFrag->FixedSize += Contents.size(); FragSpace -= Contents.size(); } _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
