Elf_External_Verdef *edefs;
unsigned int idx;
unsigned int cnt;
+ char *endbuf;
found = 1;
edefs = get_data (NULL, file, section->sh_offset, 1,
section->sh_size,
_("version definition section"));
+ endbuf = (char *) edefs + section->sh_size;
if (!edefs)
break;
int isum;
vstart = ((char *) edefs) + idx;
+ if (vstart + sizeof (*edef) > endbuf)
+ break;
edef = (Elf_External_Verdef *) vstart;
vstart += aux.vda_next;
eaux = (Elf_External_Verdaux *) vstart;
+ if (vstart + sizeof (*eaux) > endbuf)
+ break;
aux.vda_name = BYTE_GET (eaux->vda_name);
aux.vda_next = BYTE_GET (eaux->vda_next);
printf (_(" %#06x: Parent %d, name index: %ld\n"),
isum, j, aux.vda_name);
}
+ if (j < ent.vd_cnt)
+ printf (_(" Version def aux past end of section\n"));
idx += ent.vd_next;
}
+ if (cnt < section->sh_info)
+ printf (_(" Version definition past end of section\n"));
free (edefs);
}
Elf_External_Verneed *eneed;
unsigned int idx;
unsigned int cnt;
+ char *endbuf;
found = 1;
eneed = get_data (NULL, file, section->sh_offset, 1,
section->sh_size,
_("version need section"));
+ endbuf = (char *) eneed + section->sh_size;
if (!eneed)
break;
char *vstart;
vstart = ((char *) eneed) + idx;
+ if (vstart + sizeof (*entry) > endbuf)
+ break;
entry = (Elf_External_Verneed *) vstart;
Elf_External_Vernaux *eaux;
Elf_Internal_Vernaux aux;
+ if (vstart + sizeof (*eaux) > endbuf)
+ break;
eaux = (Elf_External_Vernaux *) vstart;
aux.vna_hash = BYTE_GET (eaux->vna_hash);
isum += aux.vna_next;
vstart += aux.vna_next;
}
+ if (j < ent.vn_cnt)
+ printf (_(" Version need aux past end of section\n"));
idx += ent.vn_next;
}
+ if (cnt < section->sh_info)
+ printf (_(" Version need past end of section\n"));
free (eneed);
}
{
ivna.vna_name = BYTE_GET (evna.vna_name);
- name = strtab + ivna.vna_name;
+ if (ivna.vna_name >= string_sec->sh_size)
+ name = _("*invalid*");
+ else
+ name = strtab + ivna.vna_name;
nn += printf ("(%s%-*s",
name,
12 - (int) strlen (name),
ivda.vda_name = BYTE_GET (evda.vda_name);
- name = strtab + ivda.vda_name;
+ if (ivda.vda_name >= string_sec->sh_size)
+ name = _("*invalid*");
+ else
+ name = strtab + ivda.vda_name;
nn += printf ("(%s%-*s",
name,
12 - (int) strlen (name),