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

Поиск
Список
Период
Сортировка
От Martin Liška
Тема Re: [PATCH] Code refactoring related to -fsanitize=use-after-scope
Дата
Msg-id 56C48A9D.6050900@suse.cz
обсуждение исходный текст
Ответ на Re: [PATCH] Code refactoring related to -fsanitize=use-after-scope  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: Alexander Lakhin
Дата:
Сообщение: Re: Figures in docs
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: Fix handling of invalid sockets returned by PQsocket()