public inbox for [email protected]  
help / color / mirror / Atom feed
From: Jacob Champion <[email protected]>
To: Daniel Gustafsson <[email protected]>
Cc: Tom Lane <[email protected]>
Cc: PostgreSQL Developers <[email protected]>
Subject: Re: jsonapi: scary new warnings with LTO enabled
Date: Mon, 21 Apr 2025 11:58:34 -0700
Message-ID: <CAOYmi+n7eShndhpJAZ-6+9h012nZfmuQbnj-p-L=ZnX96-PGVA@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<CAOYmi+n+DHpaEV5hymhufutTgc+S=+pDQfXEUi4hMAV1eO8aTw@mail.gmail.com>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<CAOYmi+mxjW0GhSGPKoOy3TYrFcdTM=5FcUn=u1i7CFhb2303Zg@mail.gmail.com>
	<[email protected]>
	<CAOYmi+=w3Q-3F=LCr9hPRhiG2HGv6sogGOJW3v9pwpoCD6wN+w@mail.gmail.com>
	<[email protected]>
	<CAOYmi+k+Cv4PrD9HWRh2gzZLweKK+375hBV0-N4Q9Zzb5PM24w@mail.gmail.com>
	<[email protected]>

On Mon, Apr 21, 2025 at 11:46 AM Daniel Gustafsson <[email protected]> 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





view thread (12+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: jsonapi: scary new warnings with LTO enabled
  In-Reply-To: <CAOYmi+n7eShndhpJAZ-6+9h012nZfmuQbnj-p-L=ZnX96-PGVA@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox