Assert name/short_desc to prevent SHOW ALL segfault

From: Steve Chavez <steve(at)supabase(dot)io>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Assert name/short_desc to prevent SHOW ALL segfault
Date: 2022-05-24 04:39:16
Message-ID: CAGRrpzY6hO-Kmykna_XvsTv8P2DshGiU6G3j8yGao4mk0CqjHA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello hackers,

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.

---
Steve Chavez
Engineering at https://supabase.com/

Attachment Content-Type Size
0001-Assert-name-short_desc-to-prevent-SHOWALL-segfault.patch text/x-patch 1.1 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Janes 2022-05-24 04:57:02 Re: PostgreSQL 15 Beta 1 release announcement draft
Previous Message Tom Lane 2022-05-24 04:16:25 Re: partition wise aggregate wrong rows cost