Hello Pascal,
On Thu, 13 Jun 2019, Pascal Cuoq wrote:
This appears to be caused by an offset into a dynamically allocated block
being assigned to sym in build_got_entries at line 1041:
sym = &((ElfW(Sym) *)symtab_section->data)[sym_index];
And this dynamically allocated block being realloc'ed as a result of calling
build_got(s1) at line 1102:
build_got(s1);
Bearing in mind that we keep using sym at line 1108:
attr = put_got_entry(s1, reloc_type, sym->st_size, sym->st_info,
sym_index);
I have no idea what I am doing, but I applied the following patch and it
seems to have fixed the dangling pointer, according to the tool I use (not
ASan).
The analysis and fix are correct. But there's an even better way, the
usage of sym is useless there, the function put_got_entry is recomputing
sym already anyway, so there's no need to pass stuff into it that's
readily available in a different way, removing two paramters and the
problematic use. That's what is in mob now.
Ciao,
Michael.
_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel