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: Fix potential buffer overrun in tsvector_delete().
Date: Mon, 09 Nov 2026 14:22:02 +0000
Message-ID: <E1xQQG2-000000003k7-06aW@gemulon.postgresql.org> (raw)

Fix potential buffer overrun in tsvector_delete().

tsvector_delete_by_indices() sized its output as VARSIZE(input) on the
assumption that the result can never be larger, but that only holds
when the input's lexeme data area is laid out in WordEntry order, like
the output's will be.  With a different ordering, additional pad bytes
could be needed for alignment of position data.  ts_type.h explicitly
says that a different lexeme data ordering is legal, and
tsvectorrecv() for one can produce other orderings.  To fix, use the
same solution as tsvector_concat(): allocate one extra byte per
output lexeme.  That's probably considerably more than enough, but
it's not worth working harder.

Reported-by: Anthropic OSS program
Author: Anthropic OSS program
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Backpatch-through: 14
Security: CVE-2026-116315

Branch
------
REL_17_STABLE

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

Modified Files
--------------
src/backend/utils/adt/tsvector_op.c | 24 +++++++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)



view thread (7+ messages)

Message-ID: <E1xQQG2-000000003k7-06aW@gemulon.postgresql.org>
Permalink:  ../E1xQQG2-000000003k7-06aW@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1xQQG2-000000003k7-06aW@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: Fix potential buffer overrun in tsvector_delete().
  In-Reply-To: <E1xQQG2-000000003k7-06aW@gemulon.postgresql.org>
  References: <E1xQQG2-000000003k7-06aW@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