Re: [PATCH] Code refactoring related to -fsanitize=use-after-scope

From: Martin Liška <mliska(at)suse(dot)cz>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCH] Code refactoring related to -fsanitize=use-after-scope
Date: 2016-02-17 14:58:37
Message-ID: 56C48A9D.6050900@suse.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Dean Rasheed 2016-02-17 15:00:56 Re: [patch] Proposal for \crosstabview in psql
Previous Message Teodor Sigaev 2016-02-17 14:56:26 Re: WIP: Access method extendability