[lld] cc17bfe - [lld-macho] Fix "shift exponent too large" UBSAN error
Jez Ng via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 14 10:47:38 PDT 2021
Author: Jez Ng
Date: 2021-06-14T13:47:25-04:00
New Revision: cc17bfe4898de0b57b58103bb629960f89eb4706
URL: https://github.com/llvm/llvm-project/commit/cc17bfe4898de0b57b58103bb629960f89eb4706
DIFF: https://github.com/llvm/llvm-project/commit/cc17bfe4898de0b57b58103bb629960f89eb4706.diff
LOG: [lld-macho] Fix "shift exponent too large" UBSAN error
UBSAN seems to have added this check somewhere along the way...
This might also fix the PPC buildbot, which is failing on the same test
Added:
Modified:
lld/MachO/InputFiles.cpp
Removed:
################################################################################
diff --git a/lld/MachO/InputFiles.cpp b/lld/MachO/InputFiles.cpp
index 0b5129295476..3ee19598661a 100644
--- a/lld/MachO/InputFiles.cpp
+++ b/lld/MachO/InputFiles.cpp
@@ -254,9 +254,12 @@ void ObjFile::parseSections(ArrayRef<Section> sections) {
ArrayRef<uint8_t> data = {isZeroFill(sec.flags) ? nullptr
: buf + sec.offset,
static_cast<size_t>(sec.size)};
- if (sec.align >= 32)
+ if (sec.align >= 32) {
error("alignment " + std::to_string(sec.align) + " of section " + name +
" is too large");
+ subsections.push_back({});
+ continue;
+ }
uint32_t align = 1 << sec.align;
uint32_t flags = sec.flags;
More information about the llvm-commits
mailing list