Hi Mark,

On Mon, May 18, 2026 at 1:41 PM Mark Wielaard <[email protected]> wrote:
>
> 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 <[email protected]>

LGTM.

Aaron

> ---
>  src/elfcompress.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/elfcompress.c b/src/elfcompress.c
> index f771b92afabf..630eb54da1c0 100644
> --- a/src/elfcompress.c
> +++ b/src/elfcompress.c
> @@ -424,7 +424,7 @@ process_file (const char *fname)
>        goto cleanup;
>      }
>
> -  sections = xcalloc (shnum / 8 + 1, sizeof (unsigned int));
> +  sections = xcalloc (shnum / WORD_BITS + 1, sizeof (unsigned int));
>
>    size_t phnum;
>    if (elf_getphdrnum (elf, &phnum) != 0)
> --
> 2.53.0
>

Reply via email to