Author: emaste
Date: Wed Jan 14 14:49:58 2015
New Revision: 277181
URL: https://svnweb.freebsd.org/changeset/base/277181

Log:
  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

Modified:
  head/contrib/elftoolchain/elfcopy/sections.c

Modified: head/contrib/elftoolchain/elfcopy/sections.c
==============================================================================
--- head/contrib/elftoolchain/elfcopy/sections.c        Wed Jan 14 14:49:05 
2015        (r277180)
+++ head/contrib/elftoolchain/elfcopy/sections.c        Wed Jan 14 14:49:58 
2015        (r277181)
@@ -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);
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to