From owner-svn-src-head@FreeBSD.ORG Sat May 7 11:04:37 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 50898106566B; Sat, 7 May 2011 11:04:37 +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 3FB838FC15; Sat, 7 May 2011 11:04:37 +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 p47B4bpS095809; Sat, 7 May 2011 11:04:37 GMT (envelope-from kaiw@svn.freebsd.org) Received: (from kaiw@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p47B4bPH095807; Sat, 7 May 2011 11:04:37 GMT (envelope-from kaiw@svn.freebsd.org) Message-Id: <201105071104.p47B4bPH095807@svn.freebsd.org> From: Kai Wang Date: Sat, 7 May 2011 11:04:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221595 - head/lib/libelf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 May 2011 11:04:37 -0000 Author: kaiw Date: Sat May 7 11:04:36 2011 New Revision: 221595 URL: http://svn.freebsd.org/changeset/base/221595 Log: For zero-sized sections, set the `d_buf` field of the `Elf_Data` descriptor returned by `elf_rawdata()` to NULL. Obtained from: elftoolchain Modified: head/lib/libelf/elf_data.c Modified: head/lib/libelf/elf_data.c ============================================================================== --- head/lib/libelf/elf_data.c Sat May 7 10:44:08 2011 (r221594) +++ head/lib/libelf/elf_data.c Sat May 7 11:04:36 2011 (r221595) @@ -225,7 +225,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;