From cc17bfe4898de0b57b58103bb629960f89eb4706 Mon Sep 17 00:00:00 2001 From: Jez Ng Date: Sun, 13 Jun 2021 23:20:30 -0400 Subject: [PATCH] [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 --- lld/MachO/InputFiles.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lld/MachO/InputFiles.cpp b/lld/MachO/InputFiles.cpp index 0b51292..3ee1959 100644 --- a/lld/MachO/InputFiles.cpp +++ b/lld/MachO/InputFiles.cpp @@ -254,9 +254,12 @@ void ObjFile::parseSections(ArrayRef
sections) { ArrayRef data = {isZeroFill(sec.flags) ? nullptr : buf + sec.offset, static_cast(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; -- 2.7.4