]> git.ipfire.org Git - thirdparty/elfutils.git/commit
elfcompress: Don't over allocate sections bitmap
authorMark Wielaard <mark@klomp.org>
Mon, 18 May 2026 17:33:26 +0000 (19:33 +0200)
committerMark Wielaard <mark@klomp.org>
Thu, 21 May 2026 16:46:08 +0000 (18:46 +0200)
commit59b47e80cc60a5a5aede4b7d468de00490700fa5
treef23e61b8ce85814b35eaa7c249f670108e265f01
parentef3216b29688a30bff13a81ec8a155dc7c78a5a5
elfcompress: Don't over allocate sections bitmap

In process_file we allocate a bitmap sections to track which sections
we want to (de)compress. This allocates shnum / 8 + 1 unsigned
ints. But an unsigned int can contain more bits than just 8. In all
other places we use WORD_BITS defined as 8U * sizeof (unsigned int).
Also use WORD_BITS to calculate how many unsigned ints we need for the
sections bitmap.

* src/elfcompress.c (process_file): Use shnum / WORD_BITS + 1
to allocate sections.

Signed-off-by: Mark Wielaard <mark@klomp.org>
src/elfcompress.c