This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] bfd robustification (arithmetic overflows on allocation in elf.c and corrupt version section handling)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]