Re: jsonapi: scary new warnings with LTO enabled

From: Jacob Champion <jacob(dot)champion(at)enterprisedb(dot)com>
To: Daniel Gustafsson <daniel(at)yesql(dot)se>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: jsonapi: scary new warnings with LTO enabled
Date: 2025-04-21 18:58:34
Message-ID: CAOYmi+n7eShndhpJAZ-6+9h012nZfmuQbnj-p-L=ZnX96-PGVA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Apr 21, 2025 at 11:46 AM Daniel Gustafsson <daniel(at)yesql(dot)se> wrote:
> We do, but with the current coding we call setJsonLexContextOwnsTokens
> immediately after creation which derefences the pointer without checkinf for
> allocation failure.

Right. (The flag does nothing on the OOM sentinel.)

> This means we dereference the pointer before we can check
> for an OOM return from pg_parse_json which even if safe seems to violate code
> readability no?

Personally, I'm fine with can't-fail APIs, as long as they're
documented as such. (I think the deferred error API was probably
chosen so that src/common JSON clients could be written without a lot
of pain?)

--Jacob

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Noboru Saito 2025-04-21 20:53:25 Re: [PATCH] Documentation: Fix minor grammatical and formatting issues
Previous Message Devrim Gündüz 2025-04-21 18:49:53 Re: [PoC] Federated Authn/z with OAUTHBEARER