public inbox for [email protected]  
help / color / mirror / Atom feed
From: John Naylor <[email protected]>
To: [email protected]
Subject: pgsql: Fix various instances of undefined behavior
Date: Wed, 04 Feb 2026 11:09:09 +0000
Message-ID: <[email protected]> (raw)

Fix various instances of undefined behavior

Mostly this involves checking for NULL pointer before doing operations
that add a non-zero offset.

The exception is an overflow warning in heap_fetch_toast_slice(). This
was caused by unneeded parentheses forcing an expression to be
evaluated to a negative integer, which then got cast to size_t.

Per clang 21 undefined behavior sanitizer.

Backpatch to all supported versions.

Co-authored-by: Alexander Lakhin <[email protected]>
Reported-by: Alexander Lakhin <[email protected]>
Discussion: https://postgr.es/m/[email protected]
Backpatch-through: 14

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/6b81a1c7c9057cda541401509b6dbc30a632410e

Modified Files
--------------
contrib/pg_trgm/trgm_gist.c               | 5 ++++-
src/backend/access/heap/heaptoast.c       | 2 +-
src/backend/utils/adt/multirangetypes.c   | 5 +++--
src/backend/utils/sort/sharedtuplestore.c | 3 ++-
4 files changed, 10 insertions(+), 5 deletions(-)



view thread (6+ 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]
  Subject: Re: pgsql: Fix various instances of undefined behavior
  In-Reply-To: <[email protected]>

* 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