forked from OSchip/llvm-project
[lld][MachO] Fix UB after D103006
ubsan detected: lld/MachO/SyntheticSections.cpp:636:15: runtime error: null pointer passed as argument 2, which is declared to never be null
This commit is contained in:
parent
79f9cfbc21
commit
b01bfdfda6
|
@ -633,7 +633,8 @@ void DataInCodeSection::finalizeContents() {
|
|||
}
|
||||
|
||||
void DataInCodeSection::writeTo(uint8_t *buf) const {
|
||||
memcpy(buf, entries.data(), getRawSize());
|
||||
if (!entries.empty())
|
||||
memcpy(buf, entries.data(), getRawSize());
|
||||
}
|
||||
|
||||
FunctionStartsSection::FunctionStartsSection()
|
||||
|
|
Loading…
Reference in New Issue