[PATCH] bfd: Avoid signed overflow for new_size adjustment
Alan Modra
amodra@gmail.com
Tue Dec 6 22:46:14 GMT 2022
On Tue, Dec 06, 2022 at 01:01:42PM -0800, H.J. Lu wrote:
> This doesn't work for 32-bit program since
>
> sizeof (Elf32_External_Chdr) - sizeof (Elf64_External_Chdr);
>
> is negative and will overflow.
>
> We should use
>
> *new_size -= sizeof (Elf64_External_Chdr) - sizeof (Elf32_External_Chdr);
>
> instead.
>
> OK for master?
Yes thanks.
--
Alan Modra
Australia Development Lab, IBM
More information about the Binutils
mailing list