mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-12 13:30:51 +00:00
Report errors an invalid virtual addresses.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242676 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3c7642e230
commit
96d9043a78
@ -738,9 +738,13 @@ template <class ELFT> void ELFFile<ELFT>::scanDynamicTable() {
|
||||
const Elf_Phdr **I = std::upper_bound(
|
||||
LoadSegments.begin(), LoadSegments.end(), VAddr, compareAddr<ELFT>);
|
||||
if (I == LoadSegments.begin())
|
||||
return nullptr;
|
||||
report_fatal_error("Virtual address is not in any segment");
|
||||
--I;
|
||||
return this->base() + (*I)->p_offset + (VAddr - (*I)->p_vaddr);
|
||||
const Elf_Phdr &Phdr = **I;
|
||||
uint64_t Delta = VAddr - Phdr.p_vaddr;
|
||||
if (Delta >= Phdr.p_filesz)
|
||||
report_fatal_error("Virtual address is not in any segment");
|
||||
return this->base() + Phdr.p_offset + Delta;
|
||||
};
|
||||
|
||||
for (Elf_Dyn_Iter DynI = dynamic_table_begin(), DynE = dynamic_table_end();
|
||||
|
BIN
test/Object/Inputs/corrupt-invalid-virtual-addr.elf.x86-64
Executable file
BIN
test/Object/Inputs/corrupt-invalid-virtual-addr.elf.x86-64
Executable file
Binary file not shown.
@ -37,3 +37,9 @@ RUN: %p/Inputs/corrupt-invalid-phentsize.elf.x86-64 2>&1 | \
|
||||
RUN: FileCheck --check-prefix=PHENTSIZE %s
|
||||
|
||||
PHENTSIZE: Invalid program header size
|
||||
|
||||
RUN: not llvm-readobj -dynamic-table \
|
||||
RUN: %p/Inputs/corrupt-invalid-virtual-addr.elf.x86-64 2>&1 | \
|
||||
RUN: FileCheck --check-prefix=VIRTADDR %s
|
||||
|
||||
VIRTADDR: Virtual address is not in any segment
|
||||
|
Loading…
Reference in New Issue
Block a user