if (shdr == NULL)
{
invalid_elf:
- wr_error () << "Broken ELF." << std::endl;
+ wr_error () << "Broken ELF: " << elf_errmsg (-1) << "."
+ << std::endl;
goto close_and_out;
}
const char *relocated_scnname
= elf_strptr (elf, file->ehdr.e_shstrndx,
relocated_shdr->sh_name);
+ if (unlikely (relocated_scnname == NULL))
+ goto invalid_elf;
secentry *relocated = secinfo.get (relocated_scnname);
-
if (relocated != NULL)
{
if (relocated->reldata != NULL)
srcdir=$srcdir/tests
-testfiles hello.bad-1 hello.bad-3
+testfiles hello.bad-1 hello.bad-3 garbage-1
testrun_compare ./dwarflint hello.bad-1 <<EOF
error: .debug_info: DIE 0x83: abbrev section at 0x0 doesn't contain code 83.
error: .debug_info: DIE 0xa4: toplevel DIE chain contains more than one DIE.
error: .debug_info: DIE 0xab: toplevel DIE chain contains more than one DIE.
EOF
+
+testrun_compare ./dwarflint garbage-1 <<EOF
+error: Broken ELF: offset out of range.
+error: .debug_abbrev: data not found.
+error: .debug_info: data not found.
+EOF