From e9c4e8ec6f1b13018bfb2e42a20cd80c6bbd0498 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Sat, 13 Aug 2005 03:37:49 +0000 Subject: [PATCH] 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. --- libelf/ChangeLog | 5 +++++ libelf/elf32_offscn.c | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) 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; -- 2.47.2