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]

Re: Memory corruption handling x86 relocs


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


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