pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Noah Misch <noah@leadboat.com>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Prevent construction of invalid "name" values via element assign
Date: Mon, 09 Nov 2026 14:21:52 +0000
Message-ID: <E1xQQFs-000000003PW-1e0a@gemulon.postgresql.org> (raw)

Prevent construction of invalid "name" values via element assignment.

Although type "name" is of length NAMEDATALEN, we must not allow the
last byte to become nonzero.  Otherwise, operations that treat it as
a C string will read off the end, resulting in crashes or disclosure
of server memory.  array_set_element() failed to enforce this.

Another bad outcome of element assignment could be to construct an
invalidly-encoded multibyte character.  Check that too while we're
at it.

Ideally we'd extend array_set_element()'s API to pass the array type
OID, but that's infeasible in released branches, and it seems not
worth the trouble even in master given the tiny usage of fixed-length
array types.  Instead just test for elmlen == 1 && arraytyplen ==
NAMEDATALEN to decide whether it's a name.

Reported-by: Anthropic OSS program
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Noah Misch <noah@leadboat.com>
Backpatch-through: 14
Security: CVE-2026-116321

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/82ffa9d00db962866df0a1ac4738de78db715ae6
Author: Tom Lane <tgl@sss.pgh.pa.us>

Modified Files
--------------
src/backend/utils/adt/arrayfuncs.c | 30 +++++++++++++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)



view thread (3+ messages)  latest in thread

Message-ID: <E1xQQFs-000000003PW-1e0a@gemulon.postgresql.org>
Permalink:  ../E1xQQFs-000000003PW-1e0a@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1xQQFs-000000003PW-1e0a@gemulon.postgresql.org

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: noah@leadboat.com
  Subject: Re: pgsql: Prevent construction of invalid "name" values via element assign
  In-Reply-To: <E1xQQFs-000000003PW-1e0a@gemulon.postgresql.org>
  References: <E1xQQFs-000000003PW-1e0a@gemulon.postgresql.org>

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

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