This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Memory corruption handling x86 relocs
- To: nickc at redhat dot com (Nick Clifton)
- Subject: Re: Memory corruption handling x86 relocs
- From: fnf at ninemoons dot com
- Date: Sun, 11 Feb 2001 20:20:13 -0700 (MST)
- Cc: fnf at be dot com, binutils at sources dot redhat dot com
- Reply-To: fnf at be dot com
> : + BFD_ASSERT (sreloc->reloc_count < (sreloc->_raw_size / sizeof (Elf32_External_Rel)));
>
> Why is the test for 'less than' rather than 'less than or equal to' ?
Because unless I did something wrong, at the time sreloc->reloc_count
is tested by the ASSERT, it is the index of the next location into
which an Elf32_External_Rel is going to be stored. I.E. the next
available open slot in a zero based array of Elf32_External_Rel
objects of total size sreloc->_raw_size. As soon as the store is
done, reloc_count is incremented.
-Fred