svn commit: r277181 - head/contrib/elftoolchain/elfcopy

Ed Maste emaste at FreeBSD.org
Wed Jan 14 14:49:59 UTC 2015


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);


More information about the svn-src-all mailing list