[PATCH] readelf: Always print INVALID SECTION if destshdr is NULL for relocation

Mark Wielaard mjw at redhat.com
Thu Dec 4 13:44:29 UTC 2014


On Sat, 2014-11-29 at 15:03 +0100, Mark Wielaard wrote:
> On Fri, Nov 28, 2014 at 10:24:46PM +0100, Mark Wielaard wrote:
> > We already checked this in all other cases except for the special case
> > of relocs in statically_linked executables. Found with afl.
> 
> Sorry, this patch is bogus. It works around the actual cause.
> The destshdr should not be NULL to begin with. We actually check that
> before processing the relocations. But when we see a STT_SECTION symbol
> relocation we reuse destshdr to lookup that section. The correct fix is
> to not trash destshdr in that case. Which the attached patch does.
> [...]
> +2014-11-28  Mark Wielaard  <mjw at redhat.com>
> +
> +	* readelf.c (handle_relocs_rel): Don't reuse destshdr to store
> +	section header of a relocation against a STT_SECTION symbol. Use
> +	a new local variable secshdr.
> +	(handle_relocs_rela): Likewise.

I pushed this fixed version of the fix to master now.


More information about the elfutils-devel mailing list