diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2010-04-06 09:11:42 (GMT) |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2010-04-06 09:11:42 (GMT) |
commit | deb109a10516a9e95563a334c8ab7c3062afbdde (patch) | |
tree | 409b164fe086b3d4ce103796820997ff3bf4b046 /src/patchelf.cc | |
parent | 75fb50d6d650574e706a91988259a7dde078c4bd (diff) | |
download | patchelf-deb109a10516a9e95563a334c8ab7c3062afbdde.zip patchelf-deb109a10516a9e95563a334c8ab7c3062afbdde.tar.gz patchelf-deb109a10516a9e95563a334c8ab7c3062afbdde.tar.bz2 |
* Segments can have a zero alignment, causing a divide-by-zero error.
Ignore those. (Contributed by Zack Weinberg.)
Diffstat (limited to 'src/patchelf.cc')
-rw-r--r-- | src/patchelf.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/patchelf.cc b/src/patchelf.cc index 31da196..26d5805 100644 --- a/src/patchelf.cc +++ b/src/patchelf.cc @@ -384,7 +384,8 @@ void ElfFile<ElfFileParamNames>::shiftFile(unsigned int extraPages, Elf_Addr sta /* Update the offsets in the program headers. */ for (int i = 0; i < rdi(hdr->e_phnum); ++i) { wri(phdrs[i].p_offset, rdi(phdrs[i].p_offset) + shift); - if ((phdrs[i].p_vaddr - phdrs[i].p_offset) % phdrs[i].p_align != 0) { + if (phdrs[i].p_align != 0 && + (phdrs[i].p_vaddr - phdrs[i].p_offset) % phdrs[i].p_align != 0) { debug("changing alignment of program header %d from %d to %d\n", i, phdrs[i].p_align, pageSize); phdrs[i].p_align = pageSize; |