1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 02:33:06 +01:00

[yaml2obj] Fix buildbot-issue-4886

XCOFFEmitter.cpp:67:16: runtime error: null pointer passed as argument 2,
which is declared to never be null
This commit is contained in:
Esme-Yi 2021-06-08 03:00:52 +00:00
parent a7712b1d49
commit d5c15094ae

View File

@ -64,7 +64,8 @@ private:
static void writeName(StringRef StrName, support::endian::Writer W) {
char Name[XCOFF::NameSize];
memset(Name, 0, XCOFF::NameSize);
memcpy(Name, StrName.data(), StrName.size());
char SrcName[] = "";
memcpy(Name, StrName.size() ? StrName.data() : SrcName, StrName.size());
ArrayRef<char> NameRef(Name, XCOFF::NameSize);
W.write(NameRef);
}