Hi,

On Mon, 2014-06-09 at 21:05 +0200, Thilo Schulz wrote:
> When adding data to existing sections in ELF files, libelf may corrupt
> those sections, i.e. overwrite the existing data if certain conditions are
> met.
> 
> If an Elf_Scn structure has seen a call to elf_rawdata(scn) before but no
> call to elf_getdata(scn), scn->read_data flag is set, but not
> scn->data_list_rear.

Do you happen to have a small testcase that shows the buggy behavior? 

> Thus, elf_newdata(scn) incorrectly detects a "new user added section" when
> really it is a section with live, valid data that will be overwritten by
> elf_update(), corrupting the section.
>
> This patch fixes this incorrect behaviour.

I was wondering whether we want to check scn->rawdata.s directly, or if
we could rely on ELF_F_FILEDATA being set for scn->flags?

Thanks,

Mark

Reply via email to