https://bugs.llvm.org/show_bug.cgi?id=40804
Bug ID: 40804
Summary: Allow dumping of ELF header even if some elements are
corrupt
Product: tools
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: llvm-readobj
Assignee: unassignedb...@nondot.org
Reporter: jh7370.2...@my.bristol.ac.uk
CC: jh7370.2...@my.bristol.ac.uk, llvm-bugs@lists.llvm.org
Very few elements in the ELF header are actually required to be valid to be
able to interpret the ELF header theoretically. For example, the number of
program headers or the size of the section header fields. However, if you have
a corrupt ELF, e.g. because the e_shoff field value is larger than the file
size, llvm-readobj emits an error and exits when you try to print the ELF
header. This makes it impossible to use the tool to identify the corrupt field,
making it hard to debug. Ideally, we should only load what information we need
in the ObjectFile class to interpret what we are inspecting, and only emit an
error if we can't find that information.
Here's an example lit test, which results in an error rather than printing of
the ELF header:
# RUN: yaml2obj %s -o %t
# RUN: %python -c "with(open(r'%t','ab')) as f: f.truncate(64)"
# RUN: llvm-readobj %t --file-headers | FileCheck %s
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_X86_64
Sections:
- Name: .text
Type: SHT_PROGBITS
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs