Skip to content

Commit

Permalink
[lld-macho] Fix "shift exponent too large" UBSAN error
Browse files Browse the repository at this point in the history
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
  • Loading branch information
int3 committed Jun 14, 2021
1 parent e06b9ba commit cc17bfe
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lld/MachO/InputFiles.cpp
Expand Up @@ -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;

Expand Down

0 comments on commit cc17bfe

Please sign in to comment.