libelf: Always update last_offset in updatefile and updatemmap.
authorMark Wielaard <mark@klomp.org>
Mon, 27 Mar 2017 15:01:57 +0000 (17:01 +0200)
committerMark Wielaard <mark@klomp.org>
Mon, 3 Apr 2017 22:03:27 +0000 (00:03 +0200)
commita3bf8f0852d0f66911dcf879c5a1fcff3cb4cb46
tree27ee0205ab34f687d5bdde106e8a70217f1d67a3
parent8dcc4bf791469a32c3a09ebcc23b309bf75c795f
libelf: Always update last_offset in updatefile and updatemmap.

When ELF section data was used, but not updated or marked as dirty and
there also existed non-dirty sections and some padding was needed between
the sections (possibly because of alignment) then elf_update might write
"fill" over some of the existing data. This happened because in that case
the last_position was not updated correctly.

Includes a new testcase fillfile that fails before this patch by showing
fill instead of the expected data in some section data. It succeeds with
this patch.

https://sourceware.org/bugzilla/show_bug.cgi?id=21199

Signed-off-by: Mark Wielaard <mark@klomp.org>
libelf/ChangeLog
libelf/elf32_updatefile.c
tests/ChangeLog
tests/Makefile.am
tests/fillfile.c [new file with mode: 0644]