In both handle_sysv_hash and handle_sysv_hash64 we check the has chain
isn't too long. If it is we would report an error and leak the lengths
array. Just clean up the array even in the error case.
Signed-off-by: Mark Wielaard <mark@klomp.org>
2018-06-05 Mark Wielaard <mark@klomp.org>
+ * readelf.c (handle_sysv_hash): Don't leak lengths array when
+ detecting an invalid chain.
+ (handle_sysv_hash64): Likewise.
+
+2018-06-05 Mark Wielaard <mark@klomp.org>
+
* readelf.c (print_debug_macro_section): Extend vendor array by one
to include max DW_MACRO_hi_user opcode.
++nsyms;
++chain_len;
if (chain_len > nchain)
- goto invalid_data;
+ {
+ error (0, 0, gettext ("invalid chain in sysv.hash section %d"),
+ (int) elf_ndxscn (scn));
+ free (lengths);
+ return;
+ }
if (maxlength < ++lengths[cnt])
++maxlength;
++nsyms;
++chain_len;
if (chain_len > nchain)
- goto invalid_data;
+ {
+ error (0, 0, gettext ("invalid chain in sysv.hash64 section %d"),
+ (int) elf_ndxscn (scn));
+ free (lengths);
+ return;
+ }
if (maxlength < ++lengths[cnt])
++maxlength;