elfcopy: Avoid divide-by-0 on section alignment 0

According to ELF ABI, alignment 0 and 1 has the same meaning: the
section has no alignment constraints.

PR:		196715
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Ed Maste 2015-01-14 14:49:58 +00:00
parent 07dbde6777
commit 2b39d4f68b

View File

@ -777,6 +777,8 @@ resync_sections(struct elfcopy *ecp)
continue;
/* Align section offset. */
if (s->align == 0)
s->align = 1;
if (off <= s->off) {
if (!s->loadable)
s->off = roundup(off, s->align);