Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Jan 2015 14:49:59 +0000 (UTC)
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r277181 - head/contrib/elftoolchain/elfcopy
Message-ID:  <201501141449.t0EEnxsW028154@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201501141449.t0EEnxsW028154>