Re: Assert name/short_desc to prevent SHOW ALL segfault

Поиск
Список
Период
Сортировка
От Nathan Bossart
Тема Re: Assert name/short_desc to prevent SHOW ALL segfault
Дата
Msg-id 20220524184149.GA1193238@nathanxps13
обсуждение исходный текст
Ответ на Assert name/short_desc to prevent SHOW ALL segfault  (Steve Chavez <steve@supabase.io>)
Ответы Re: Assert name/short_desc to prevent SHOW ALL segfault  (Michael Paquier <michael@paquier.xyz>)
Re: Assert name/short_desc to prevent SHOW ALL segfault  (Andres Freund <andres@anarazel.de>)
Список pgsql-hackers
On Mon, May 23, 2022 at 11:39:16PM -0500, Steve Chavez wrote:
> The DefineCustomStringVariable function(or any
> other DefineCustomXXXVariable) has a short_desc parameter that can be
> NULL and it's not apparent that this will lead to a segfault when SHOW ALL
> is used.
> This happens because the ShowAllGUCConfig function expects a non-NULL
> short_desc.
> 
> This happened for the Supabase supautils extension(
> https://github.com/supabase/supautils/issues/24) and any other extension
> that uses the DefineCustomXXXVariable has the same bug risk.
> 
> This patch does an Assert on the short_desc(also on the name as an extra
> measure), so a postgres built with --enable-cassert can prevent the above
> issue.

I would actually ERROR on this so that we aren't relying on
--enable-cassert builds to catch it.  That being said, if there's no strong
reason to enforce that a short description be provided, then why not adjust
ShowAllGUCConfig() to set that column to NULL when short_desc is missing?

-- 
Nathan Bossart
Amazon Web Services: https://aws.amazon.com



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Zhihong Yu
Дата:
Сообщение: Re: adding status for COPY progress report
Следующее
От: Christoph Berg
Дата:
Сообщение: Re: 15beta1 test failure on mips in isolation/expected/stats