From 7d97e735892b478bde261c6a2f197c6deec1e18c Mon Sep 17 00:00:00 2001 From: George Rimar Date: Mon, 17 Oct 2016 10:06:44 +0000 Subject: [Object/ELF] - Check that e_shnum is null when e_shoff is. Spec says (http://www.sco.com/developers/gabi/1998-04-29/ch4.eheader.html) : e_shnum This member holds the number of entries in the section header table. Thus the product of e_shentsize and e_shnum gives the section header table's size in bytes. If a file has no section header table, e_shnum holds the value zero. Revealed using "id_000037,sig_11,src_000015,op_havoc,rep_8" from PR30540 That was the reason of crash in lld on incorrect input file. Binary reduced using afl-min. Differential revision: https://reviews.llvm.org/D25090 llvm-svn: 284371 --- llvm/test/Object/Inputs/invalid-e_shnum.elf | Bin 0 -> 64 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 llvm/test/Object/Inputs/invalid-e_shnum.elf (limited to 'llvm/test/Object/Inputs') diff --git a/llvm/test/Object/Inputs/invalid-e_shnum.elf b/llvm/test/Object/Inputs/invalid-e_shnum.elf new file mode 100644 index 00000000000..0b46fbd8cec Binary files /dev/null and b/llvm/test/Object/Inputs/invalid-e_shnum.elf differ -- cgit v1.2.3