Fix gcc -fsanitize=nonnull-attribute issues

Mark Wielaard mjw at redhat.com
Fri Jun 5 12:47:00 UTC 2015


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.


More information about the elfutils-devel mailing list