diff options
author | emaste <emaste@FreeBSD.org> | 2015-01-14 14:49:58 +0000 |
---|---|---|
committer | emaste <emaste@FreeBSD.org> | 2015-01-14 14:49:58 +0000 |
commit | f5b1a66d7adde0f6ce7970d2baa46b91db44b387 (patch) | |
tree | 6a3ead898adf2261184689256112ca9a5ed548f1 /contrib/elftoolchain/elfcopy | |
parent | 99b91105134836ab8410881a39784eacdcd8a1c2 (diff) | |
download | FreeBSD-src-f5b1a66d7adde0f6ce7970d2baa46b91db44b387.zip FreeBSD-src-f5b1a66d7adde0f6ce7970d2baa46b91db44b387.tar.gz |
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
Diffstat (limited to 'contrib/elftoolchain/elfcopy')
-rw-r--r-- | contrib/elftoolchain/elfcopy/sections.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/contrib/elftoolchain/elfcopy/sections.c b/contrib/elftoolchain/elfcopy/sections.c index 6c733f8..4d23bc7 100644 --- a/contrib/elftoolchain/elfcopy/sections.c +++ b/contrib/elftoolchain/elfcopy/sections.c @@ -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); |