From: Roland McGrath Date: Sat, 13 Aug 2005 03:37:49 +0000 (+0000) Subject: libelf/ X-Git-Tag: elfutils-0.120~124 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e9c4e8ec6f1b13018bfb2e42a20cd80c6bbd0498;p=thirdparty%2Felfutils.git libelf/ 2005-08-12 Roland McGrath * elf32_offscn.c: Do not match empty sections at OFFSET unless there are no nonempty sections at that offset. --- diff --git a/libelf/ChangeLog b/libelf/ChangeLog index aa2a0b11b..67d4f3951 100644 --- a/libelf/ChangeLog +++ b/libelf/ChangeLog @@ -1,3 +1,8 @@ +2005-08-12 Roland McGrath + + * elf32_offscn.c: Do not match empty sections at OFFSET unless + there are no nonempty sections at that offset. + 2005-08-07 Ulrich Drepper * elf.h: Update from glibc. diff --git a/libelf/elf32_offscn.c b/libelf/elf32_offscn.c index 8a803b76b..843f8b00b 100644 --- a/libelf/elf32_offscn.c +++ b/libelf/elf32_offscn.c @@ -56,7 +56,12 @@ elfw2(LIBELFBITS,offscn) (elf, offset) if (runp->data[i].shdr.ELFW(e,LIBELFBITS)->sh_offset == offset) { result = &runp->data[i]; - goto out; + + /* If this section is empty, the following one has the same + sh_offset. We presume the caller is looking for a nonempty + section, so keep looking if this one is empty. */ + if (runp->data[i].shdr.ELFW(e,LIBELFBITS)->sh_size != 0) + goto out; } runp = runp->next;