This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
Re: Fix gcc -fsanitize=nonnull-attribute issues
- From: Mark Wielaard <mjw at redhat dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Fri, 05 Jun 2015 14:47:00 +0200
- Subject: Re: Fix gcc -fsanitize=nonnull-attribute issues
On Sun, 2015-05-31 at 17:51 +0200, Mark Wielaard wrote:
> GCC 5.1 includes -fsanitize=nonnull-attribute in -fsanitize=undefined.
> This showed a couple of places where we were passing a NULL argument
> to functions not expecting them. Even though these functions might not
> actually use the argument (if for example the size argument of a buffer
> is zero), gcc might use the information to assume the passed in variables
> are always nonnull, which might cause unexpected optimizations.
>
> libdwfl: Check file_name is not NULL before calling canonicalize_file_name.
> libelf: Don't call mempcpy with possible NULL d_buf.
> libelf: Don't call memmove with possible NULL buffer.
> elfcmp: Don't call memcmp with possible NULL d_buf.
Pushed all 4 commits to master.