[llvm] [MachO] Detect overflow in section offset. (PR #98685)
Jon Roelofs via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 12 13:00:08 PDT 2024
================
@@ -277,6 +277,8 @@ void MachObjectWriter::writeSection(const MCAssembler &Asm,
W.write<uint32_t>(VMAddr); // address
W.write<uint32_t>(SectionSize); // size
}
+ if (!isUInt<32>(FileOffset))
+ report_fatal_error("Cannot encode offset of section");
W.write<uint32_t>(FileOffset);
W.write<uint32_t>(Log2(Section.getAlign()));
----------------
jroelofs wrote:
Mind adding another one for `RelocationStart`? Looks like it might have the same problem.
https://github.com/llvm/llvm-project/pull/98685
More information about the llvm-commits
mailing list