[lld] [lld][macho] Fix segfault while processing malformed object file. (PR #167025)
Prabhu Rajasekaran via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 10 14:54:56 PST 2025
================
@@ -808,6 +808,10 @@ void ObjFile::parseSymbols(ArrayRef<typename LP::section> sectionHeaders,
continue;
if ((sym.n_type & N_TYPE) == N_SECT) {
+ if (sym.n_sect == 0) {
----------------
Prabhuk wrote:
https://github.com/llvm/llvm-project/blob/main/llvm/lib/MC/MachObjectWriter.cpp#L649 -- The object file writer asserts when the section size is larger than 255. But in our toolchain distributions we have assertions disabled. This caused us to create an object file that triggered this segfault during link. This bug has all the details: https://github.com/llvm/llvm-project/issues/167408
https://github.com/llvm/llvm-project/pull/167025
More information about the llvm-commits
mailing list