mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01: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. llvm-svn: 314368
This commit is contained in:
parent
9721e58798
commit
229877e82c
@ -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…
Reference in New Issue
Block a user