This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [PATCH] bfd robustification (arithmetic overflows on allocation in elf.c and corrupt version section handling)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Nick Clifton <nickc at redhat dot com>
- Cc: binutils at sources dot redhat dot com
- Date: Mon, 4 Jul 2005 21:16:27 +0200
- Subject: Re: [PATCH] bfd robustification (arithmetic overflows on allocation in elf.c and corrupt version section handling)
- References: <20050615212716.GO7663@sunsite.mff.cuni.cz> <42C951DF.6000106@redhat.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Mon, Jul 04, 2005 at 04:12:31PM +0100, Nick Clifton wrote:
> But ... have you looked at PR binutils/868 ? It applies particularly to
> the use of the realloc() function, but it might be worth considering in
> the wider context of the changes that you are making.
I think that should be orthogonal to those changes. So bfd could provide
bfd_realloc, bfd_realloc_or_free, bfd_realloc2 and bfd_realloc2_or_free.
> >+#define HALF_BFD_SIZE_TYPE \
> >+ (((bfd_size_type) 1) << (8 * sizeof (bfd_size_type) / 2))
>
> Hmm, does this 8 assume that a byte is an 8-bit quantity ?
It does, but I thought we rely on the host char being 8 bit,
only target char can be different. I could use CHAR_BIT instead,
but nothing in bfd/binutils/ld uses CHAR_BIT ATM, so it would
surprise me if it worked at all with CHAR_BIT != 8.
Jakub