This is the mail archive of the
mailing list for the elfutils project.
Fix gcc -fsanitize=nonnull-attribute issues
- From: Mark Wielaard <mjw at redhat dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Sun, 31 May 2015 17:51:48 +0200
- Subject: Fix gcc -fsanitize=nonnull-attribute issues
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.