Re: Support json_errdetail in FRONTEND builds

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Jacob Champion <jacob(dot)champion(at)enterprisedb(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, alvherre(at)alvh(dot)no-ip(dot)org
Subject: Re: Support json_errdetail in FRONTEND builds
Date: 2024-03-15 09:32:00
Message-ID: CA5E9481-D63A-41BF-B4A5-88046A6195E0@yesql.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On 15 Mar 2024, at 01:10, Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>
> On Thu, Mar 14, 2024 at 10:56:46AM +0100, Daniel Gustafsson wrote:
>> + /* don't allow destroys of read-only StringInfos */
>> + Assert(str->maxlen != 0);
>> Considering that StringInfo.c don't own the memory here I think it's warranted
>> to turn this assert into an elog() to avoid the risk of use-after-free bugs.
>
> Hmm. I am not sure how much protection this would offer, TBH.

I can't see how refusing to free memory owned and controlled by someone else,
and throwing an error if attempted, wouldn't be a sound defensive programming
measure.

--
Daniel Gustafsson

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Sutou Kouhei 2024-03-15 09:36:55 Re: meson: Specify -Wformat as a common warning flag for extensions
Previous Message Heikki Linnakangas 2024-03-15 09:23:31 Re: Weird test mixup