+2022-05-10 Mark Wielaard <mark@klomp.org>
+
+ * elfcompress.c (process_file): Sanity check shstrtab_name,
+ shstrtab_newname and symstrents are only set once.
+
2022-04-24 Mark Wielaard <mark@klomp.org>
* elfclassify.c (main): Use classify_flag_no_stdin for no-std in options.
{
shstrtab_size = size;
shstrtab_compressed = T_COMPRESS_GNU;
+ if (shstrtab_name != NULL
+ || shstrtab_newname != NULL)
+ {
+ error (0, 0, "Internal error,"
+ " shstrtab_name already set,"
+ " while handling section [%zd] %s",
+ ndx, sname);
+ goto cleanup;
+ }
shstrtab_name = xstrdup (sname);
shstrtab_newname = xstrdup (newname);
}
{
shstrtab_size = size;
shstrtab_compressed = T_COMPRESS_ZLIB;
+ if (shstrtab_name != NULL
+ || shstrtab_newname != NULL)
+ {
+ error (0, 0, "Internal error,"
+ " shstrtab_name already set,"
+ " while handling section [%zd] %s",
+ ndx, sname);
+ goto cleanup;
+ }
shstrtab_name = xstrdup (sname);
shstrtab_newname = (newname == NULL
? NULL : xstrdup (newname));
}
size_t elsize = gelf_fsize (elfnew, ELF_T_SYM, 1, EV_CURRENT);
size_t syms = symd->d_size / elsize;
+ if (symstrents != NULL)
+ {
+ error (0, 0, "Internal error, symstrents already set,"
+ " while handling section [%zd] %s", ndx, name);
+ goto cleanup;
+ }
symstrents = xmalloc (syms * sizeof (Dwelf_Strent *));
for (size_t i = 0; i < syms; i++)
{