This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/2] libdwfl: elf_from_remote_memory only trust shdrs of last file-only segment.


On Sun, 2014-03-16 at 17:46 +0100, Jan Kratochvil wrote:
> On Mon, 03 Mar 2014 15:31:28 +0100, Mark Wielaard wrote:
> > @@ -321,8 +328,9 @@ elf_from_remote_memory (GElf_Addr ehdr_vma,
> >  	    goto read_error;
> >  
> >        /* If the segments visible in memory didn't include the section
> > -	 headers, then clear them from the file header.  */
> > -      if (contents_size < shdrs_end)
> > +	 headers or the memory might be used for something else, then
> > +	 clear them from the file header.  */
> > +      if (contents_size < shdrs_end || segments_end != segments_end_mem)
> >  	{
> >  	  ehdr.e64.e_shoff = 0;
> >  	  ehdr.e64.e_shnum = 0;
> 
> I do not see why to make this change.  The chunk @@ -253,9 +258,11 @@ above
> already trimmed contents_size to segment's FileSiz so the original conditional
> 'contents_size < shdrs_end' has to be true.

Yes, you are right, that extra check is redundant. Removed.

> I am OK with the patch if the last chunk gets removed.

Thanks, pushed to master with that extra check removed.

Cheers,

Mark


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]