dress
dress copied to clipboard
Fixing segfault due to realloc
When operating on binaries with large amounts of symbols (ie statically linked), the expanded_section_hdr ptr was becoming invalid after the call to realloc in increase_file_size. I moved it to a stack variable (bit of a hacky fix I know), and now I am able to write an arbitrary number of symbols into the outfile.
Readelf was also complaining about the symbol information, which is fixed in line 325.
I also added the ability to have a size written to the symbol table as well for each symbol.
Looks good. Do you mind factoring out global_sh_info_index
into the state struct that way there more than one elf can be used at once?
Think the latest commit is what you wanted, I haven't looked at this in a while so sorry if it's not correct. I also added a get_size() function, with an example format in size_example.syms. Note that if no size is set it just defaults to the original behaviour.