From owner-svn-src-stable@FreeBSD.ORG Tue Feb 14 19:48:57 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C2683106566B; Tue, 14 Feb 2012 19:48:57 +0000 (UTC) (envelope-from kaiw@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B0F4E8FC0A; Tue, 14 Feb 2012 19:48:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1EJmvtq015136; Tue, 14 Feb 2012 19:48:57 GMT (envelope-from kaiw@svn.freebsd.org) Received: (from kaiw@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1EJmv0L015134; Tue, 14 Feb 2012 19:48:57 GMT (envelope-from kaiw@svn.freebsd.org) Message-Id: <201202141948.q1EJmv0L015134@svn.freebsd.org> From: Kai Wang Date: Tue, 14 Feb 2012 19:48:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231703 - stable/8/lib/libelf X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 19:48:57 -0000 Author: kaiw Date: Tue Feb 14 19:48:57 2012 New Revision: 231703 URL: http://svn.freebsd.org/changeset/base/231703 Log: MFC r221595: For zero-sized sections, set the `d_buf` field of the `Elf_Data` descriptor returned by `elf_rawdata()` to NULL. Modified: stable/8/lib/libelf/elf_data.c Directory Properties: stable/8/lib/libelf/ (props changed) Modified: stable/8/lib/libelf/elf_data.c ============================================================================== --- stable/8/lib/libelf/elf_data.c Tue Feb 14 19:36:35 2012 (r231702) +++ stable/8/lib/libelf/elf_data.c Tue Feb 14 19:48:57 2012 (r231703) @@ -223,7 +223,8 @@ elf_rawdata(Elf_Scn *s, Elf_Data *d) if ((d = _libelf_allocate_data(s)) == NULL) return (NULL); - d->d_buf = sh_type == SHT_NOBITS ? NULL : e->e_rawfile + sh_offset; + d->d_buf = (sh_type == SHT_NOBITS || sh_size == 0) ? NULL : + e->e_rawfile + sh_offset; d->d_off = 0; d->d_align = sh_align; d->d_size = sh_size;