]> git.ipfire.org Git - thirdparty/elfutils.git/commit
libelf: elf_compress doesn't handle multiple elf_newdata chunks correctly
authorMark Wielaard <mark@klomp.org>
Tue, 20 Aug 2024 15:59:01 +0000 (17:59 +0200)
committerMark Wielaard <mark@klomp.org>
Fri, 18 Oct 2024 08:54:02 +0000 (10:54 +0200)
commit43179302d7041e562a9df97165ed15c1c2c7bc22
tree09d8c0e4ce54e10a1ca6b963938b32b674c8b5b6
parent245f19c1e285599bc7441d096d672628bed13797
libelf: elf_compress doesn't handle multiple elf_newdata chunks correctly

elf_compress would compress all (new) data chunks, but didn't reset
the section data_list. This would cause extra data to be returned
after decompression or create bad compressed data. Add a new testcase
for this and explicitly zap the scn->data_list before resetting the
elf section raw data after (de)compression.

 * libelf/elf_compress.c (__libelf_reset_rawdata): Cleanup
         scn->data_list.
 * tests/newzdata.c: New testcase.
 * tests/Makefile.am (check_PROGRAMS): Add newzdata.
 (TESTS): Likewise.
 (newzdata_LDADD): New variable.

https://sourceware.org/bugzilla/show_bug.cgi?id=32102

Signed-off-by: Mark Wielaard <mark@klomp.org>
libelf/elf_compress.c
tests/Makefile.am
tests/newzdata.c [new file with mode: 0644]