Skip to content

Commit c34f76d

Browse files
authored
[dsymutil] Add missing validation for zero alignment section (#168925)
1 parent 423bdb2 commit c34f76d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

llvm/tools/dsymutil/MachOUtils.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -339,11 +339,11 @@ static bool createDwarfSegment(const MCAssembler& Asm,uint64_t VMAddr, uint64_t
339339
if (Alignment > 1) {
340340
VMAddr = alignTo(VMAddr, Alignment);
341341
FileOffset = alignTo(FileOffset, Alignment);
342-
if (FileOffset > UINT32_MAX)
343-
return error("section " + Sec->getName() +
344-
"'s file offset exceeds 4GB."
345-
" Refusing to produce an invalid Mach-O file.");
346342
}
343+
if (FileOffset > UINT32_MAX)
344+
return error("section " + Sec->getName() +
345+
"'s file offset exceeds 4GB."
346+
" Refusing to produce an invalid Mach-O file.");
347347
Writer.writeSection(Asm, *Sec, VMAddr, FileOffset, 0, 0, 0);
348348

349349
FileOffset += Asm.getSectionAddressSize(*Sec);

0 commit comments

Comments
 (0)