[lld] r283208 - [ELF] - Do not hang if broken object has option descriptor in .MIPS.options with size of zero.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 4 03:23:08 PDT 2016
Author: grimar
Date: Tue Oct 4 05:23:07 2016
New Revision: 283208
URL: http://llvm.org/viewvc/llvm-project?rev=283208&view=rev
Log:
[ELF] - Do not hang if broken object has option descriptor in .MIPS.options with size of zero.
Previously lld would hang in infinite loop in this case,
patch fixes the issue. Object was found during AFL run.
Differential revision: https://reviews.llvm.org/D25229
Added:
lld/trunk/test/ELF/invalid/Inputs/mips-invalid-options-descriptor.elf (with props)
lld/trunk/test/ELF/invalid/mips-invalid-options-descriptor.s
Modified:
lld/trunk/ELF/InputSection.cpp
Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=283208&r1=283207&r2=283208&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Tue Oct 4 05:23:07 2016
@@ -694,6 +694,8 @@ MipsOptionsInputSection<ELFT>::MipsOptio
error(getName(this) + ": unsupported non-zero ri_gp_value");
break;
}
+ if (!O->size)
+ fatal(getName(this) + ": zero option descriptor size");
D = D.slice(O->size);
}
}
Added: lld/trunk/test/ELF/invalid/Inputs/mips-invalid-options-descriptor.elf
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/invalid/Inputs/mips-invalid-options-descriptor.elf?rev=283208&view=auto
==============================================================================
Binary file - no diff available.
Propchange: lld/trunk/test/ELF/invalid/Inputs/mips-invalid-options-descriptor.elf
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: lld/trunk/test/ELF/invalid/mips-invalid-options-descriptor.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/invalid/mips-invalid-options-descriptor.s?rev=283208&view=auto
==============================================================================
--- lld/trunk/test/ELF/invalid/mips-invalid-options-descriptor.s (added)
+++ lld/trunk/test/ELF/invalid/mips-invalid-options-descriptor.s Tue Oct 4 05:23:07 2016
@@ -0,0 +1,5 @@
+## mips-invalid-options-descriptor.elf has option descriptor in
+## .MIPS.options with size of zero.
+# RUN: not ld.lld %p/Inputs/mips-invalid-options-descriptor.elf -o %t2 2>&1 | \
+# RUN: FileCheck %s
+# CHECK: zero option descriptor size
More information about the llvm-commits
mailing list