On 32bit using int might overflow.
https://bugzilla.redhat.com/show_bug.cgi?id=
1170810#c31
Signed-off-by: Mark Wielaard <mjw@redhat.com>
* elflint.c (check_gnu_hash): Return early when 2nd hash function
shift too big.
+ (check_verdef): Use Elf64_Word for shdr->sh_info cnt.
+ (check_verneed): Likewise.
2015-05-05 Mark Wielaard <mjw@redhat.com>
return;
}
unsigned int offset = 0;
- for (int cnt = shdr->sh_info; --cnt >= 0; )
+ for (Elf64_Word cnt = shdr->sh_info; cnt > 0; )
{
+ cnt--;
+
/* Get the data at the next offset. */
GElf_Verneed needmem;
GElf_Verneed *need = gelf_getverneed (data, offset, &needmem);
bool has_base = false;
unsigned int offset = 0;
- for (int cnt = shdr->sh_info; --cnt >= 0; )
+ for (Elf64_Word cnt = shdr->sh_info; cnt > 0; )
{
+ cnt--;
+
/* Get the data at the next offset. */
GElf_Verdef defmem;
GElf_Verdef *def = gelf_getverdef (data, offset, &defmem);