Re: [PATCH] Code refactoring related to -fsanitize=use-after-scope - Mailing list pgsql-hackers

From Martin Liška
Subject Re: [PATCH] Code refactoring related to -fsanitize=use-after-scope
Date
Msg-id 56C48A9D.6050900@suse.cz
Whole thread Raw
In response to Re: [PATCH] Code refactoring related to -fsanitize=use-after-scope  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 02/15/2016 08:20 PM, Tom Lane wrote:
> I bet a nickel that this is triggered by the goto leading into those
> variables' scope ("goto process_inner_tuple" at line 2038 in HEAD).
> That probably bypasses the "unpoison" step.
> 
> However, doesn't this represent a bug in the sanitizer rather than
> anything we should change in Postgres?  There is no rule in C that
> you can't execute such a goto, especially not if there is no
> initialization of those variables.
> 
> If you can think of a reasonable refactoring that gets rid of the need
> for that goto, I'd be for that, because it's certainly unsightly.
> But I don't think it's wrong, and I don't think that the proposed patch
> is any improvement from a structured-programming standpoint.
> 
>             regards, tom lane

Hi Tom.

You are exactly right that as the code does not expose an initialization,
it should work fine. As you mentioned, unpoisoning is skipped that exposes
this false positive.

I'll try to think about the case and handle that. Application of my patch
does not make sense.

Martin



pgsql-hackers by date:

Previous
From: Alexander Lakhin
Date:
Subject: Re: Figures in docs
Next
From: Alvaro Herrera
Date:
Subject: Re: Fix handling of invalid sockets returned by PQsocket()