[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] -fsanitizer=address

From: Michael Matz
Subject: Re: [Tinycc-devel] -fsanitizer=address
Date: Sun, 16 Jun 2019 22:11:08 +0200 (CEST)
User-agent: Alpine 2.21 (LSU 202 2017-01-01)

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:


Bearing in mind that we keep using sym at line 1108:

            attr = put_got_entry(s1, reloc_type, sym->st_size, sym->st_info,

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

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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]