projects
/
platform
/
upstream
/
llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
72e75ca
)
[lld-macho] Fix memcpy ub after D93267
author
Fangrui Song
<i@maskray.me>
Mon, 21 Dec 2020 04:01:20 +0000
(20:01 -0800)
committer
Fangrui Song
<i@maskray.me>
Mon, 21 Dec 2020 04:01:20 +0000
(20:01 -0800)
lld/MachO/UnwindInfoSection.cpp
patch
|
blob
|
history
diff --git
a/lld/MachO/UnwindInfoSection.cpp
b/lld/MachO/UnwindInfoSection.cpp
index
acb4a9d
..
b4c3a31
100644
(file)
--- a/
lld/MachO/UnwindInfoSection.cpp
+++ b/
lld/MachO/UnwindInfoSection.cpp
@@
-318,8
+318,9
@@
void UnwindInfoSection::writeTo(uint8_t *buf) const {
*ep++ = (it->second << COMPRESSED_ENTRY_FUNC_OFFSET_BITS) |
(cuep->functionAddress - functionAddressBase);
}
- memcpy(ep, page.localEncodings.data(),
- page.localEncodings.size() * sizeof(uint32_t));
+ if (page.localEncodings.size() != 0)
+ memcpy(ep, page.localEncodings.data(),
+ page.localEncodings.size() * sizeof(uint32_t));
} else {
auto *p2p =
reinterpret_cast<unwind_info_regular_second_level_page_header *>(pp);