This is the mail archive of the
mailing list for the elfutils project.
Re: [PATCH] libelf: Make sure version xlate dest buffer is fully defined.
- From: Mark Wielaard <mjw at redhat dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Wed, 06 May 2015 13:44:56 +0200
- Subject: Re: [PATCH] libelf: Make sure version xlate dest buffer is fully defined.
On Sat, 2015-01-03 at 23:02 +0100, Mark Wielaard wrote:
> contains an example of usage of undefined memory when version section
> data needs to be translated, but the version xlate functions detect they
> cannot fully transform the section data. To make sure the dest buffer
> data is completely defined this patch makes sure all data is moved
> from src to dest first. This is somewhat inefficient since normally
> all data will be fully converted. But the translation functions have
> no way to indicate only partial data was converted.
> Reported-by: Alexander Cherepanov <email@example.com>
> Signed-off-by: Mark Wielaard <firstname.lastname@example.org>
> --- a/libelf/ChangeLog
> +++ b/libelf/ChangeLog
> @@ -1,3 +1,8 @@
> +2015-01-03 Mark Wielaard <email@example.com>
> + * version_xlate.h (elf_cvt_Verdef): Use memmove to copy src to dest.
> + (elf_cvt_Verneed): Likewise.
I have finally pushed this to master.
I don't particularly like this solution. But the extra work is only done
when doing conversion of version data representation of the ELF file on
disk is different from the native data representation in memory.