unstrip: Add sanity check for bogus sh_offset of allocated sections.
authorMark Wielaard <mark@klomp.org>
Sun, 20 Oct 2019 15:26:29 +0000 (17:26 +0200)
committerMark Wielaard <mark@klomp.org>
Sat, 26 Oct 2019 00:13:47 +0000 (02:13 +0200)
commit9d3003f6b0baa94a53013fbefb4f6542bc532a6c
tree6ce2fb5eb71504096f6dbee106fc3241ae781029
parent90f4bb30381b0354b8b40cd09e68005713bfd69a
unstrip: Add sanity check for bogus sh_offset of allocated sections.

unstrip tries to preserve any allocated section offset in an
executable or shared library. If the offset is extremely large that
would cause the disk to fill up because we will write out a file with
lots of padding to put the section contents at that particular
offset. Add a sanity check that makes sure we just error out if there
is such a bogus offset by checking that no offset is larger than the
original ELF file size.

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

Signed-off-by: Mark Wielaard <mark@klomp.org>
src/ChangeLog
src/unstrip.c