pgsql: Fix potential buffer overrun in tsvector_delete().

From: Noah Misch <noah(at)leadboat(dot)com>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix potential buffer overrun in tsvector_delete().
Date: 2026-11-09 14:21:48
Message-ID: E1xQQFo-000000003Ft-0Aeg@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(at)sss(dot)pgh(dot)pa(dot)us>
Backpatch-through: 14
Security: CVE-2026-116315

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/27dfe0e341c30cdc156a849034268f5dc38c1d29
Author: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>

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

Browse pgsql-committers by date

  From Date Subject
Next Message Noah Misch 2026-11-09 14:21:49 pgsql: Reject more unsafe names in extension script substitutions.
Previous Message Noah Misch 2026-11-09 14:21:47 pgsql: pg_basebackup: Fix use of externally-controlled format string