Re: Support json_errdetail in FRONTEND builds - Mailing list pgsql-hackers

From Daniel Gustafsson
Subject Re: Support json_errdetail in FRONTEND builds
Date
Msg-id CA5E9481-D63A-41BF-B4A5-88046A6195E0@yesql.se
Whole thread Raw
In response to Re: Support json_errdetail in FRONTEND builds  (Michael Paquier <michael@paquier.xyz>)
Responses Re: Support json_errdetail in FRONTEND builds
List pgsql-hackers
> On 15 Mar 2024, at 01:10, Michael Paquier <michael@paquier.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




pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Weird test mixup
Next
From: Sutou Kouhei
Date:
Subject: Re: meson: Specify -Wformat as a common warning flag for extensions