Memory corruption handling x86 relocs

fnf@ninemoons.com fnf@ninemoons.com
Mon Feb 12 05:43:00 GMT 2001


> : + 	      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



More information about the Binutils mailing list