This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix an assert failure with gap between sections


There can be a gap even if the previous section did not change.
Additionally, last_section didn't seem to take the gap into
account, which would result in an assert fail later on.
---
 libelf/elf32_updatefile.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/libelf/elf32_updatefile.c b/libelf/elf32_updatefile.c
index a4d83a1..a5be31d 100644
--- a/libelf/elf32_updatefile.c
+++ b/libelf/elf32_updatefile.c
@@ -336,10 +336,13 @@ __elfw2(LIBELFBITS,updatemmap) (Elf *elf, int change_=
bo, size_t shnum)
 =

 		/* If there is a gap, fill it.  */
 		if (scn_start + dl->data.d.d_off > last_position
-		    && ((previous_scn_changed && dl->data.d.d_off =3D=3D 0)
+		    && ((dl->data.d.d_off =3D=3D 0)
 			|| ((scn->flags | dl->flags | elf->flags)
 			    & ELF_F_DIRTY) !=3D 0))
-		  fill_mmap (dl->data.d.d_off);
+                  {
+		    fill_mmap (dl->data.d.d_off);
+		    last_position =3D scn_start + dl->data.d.d_off;
+                  }
 =

 		if ((scn->flags | dl->flags | elf->flags) & ELF_F_DIRTY)
 		  {
-- =

1.6.3.3


--===============7879206636049156915==--

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]