Date: Sat, 7 May 2011 11:04:37 +0000 (UTC) From: Kai Wang <kaiw@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r221595 - head/lib/libelf Message-ID: <201105071104.p47B4bPH095807@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201105071104.p47B4bPH095807>