Fix division by zero in prelink detection, issue 420
Avoid dividing by zero when hitting an ELF section without fixed-size entries. Thanks to Michael Schroeder for helping trace the problem (in #420)
This commit is contained in:
parent
61d23649cb
commit
2e3867ebce
|
@ -54,7 +54,7 @@ static int is_prelinked(int fdno)
|
||||||
|
|
||||||
while (!prelinked && (scn = elf_nextscn(elf, scn)) != NULL) {
|
while (!prelinked && (scn = elf_nextscn(elf, scn)) != NULL) {
|
||||||
(void) gelf_getshdr(scn, &shdr);
|
(void) gelf_getshdr(scn, &shdr);
|
||||||
if (shdr.sh_type != SHT_DYNAMIC)
|
if (shdr.sh_type != SHT_DYNAMIC || shdr.sh_entsize == 0)
|
||||||
continue;
|
continue;
|
||||||
while (!prelinked && (data = elf_getdata (scn, data)) != NULL) {
|
while (!prelinked && (data = elf_getdata (scn, data)) != NULL) {
|
||||||
int maxndx = data->d_size / shdr.sh_entsize;
|
int maxndx = data->d_size / shdr.sh_entsize;
|
||||||
|
|
Loading…
Reference in New Issue