mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-22 02:05:01 +00:00
Fix a UBsan bot.
If we do not initialize Prefix here, Prefix.data() returns a nullptr. Later, it is passed to memcpy. memcpy's behavior is undefined if src (or dst) is a nullptr even if a given size is 0. That's why this code triggered UBsan. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314368 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5c883452a8
commit
76b3e046e7
@ -127,6 +127,7 @@ static void writePaxHeader(raw_fd_ostream &OS, StringRef Path) {
|
||||
// Otherwise, returns false.
|
||||
static bool splitUstar(StringRef Path, StringRef &Prefix, StringRef &Name) {
|
||||
if (Path.size() < sizeof(UstarHeader::Name)) {
|
||||
Prefix = "";
|
||||
Name = Path;
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user