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:22:02
Message-ID: E1xQQG2-000000003k7-06aW@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
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/cacc71935952b1e47d852a9e9be3a548fc5ac40e
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:22:03 pgsql: Reject extnamespace if it's temporary or it's '$user'::regnamesp
Previous Message Noah Misch 2026-11-09 14:22:01 pgsql: Introduce attribute versioning to prevent unsafe deforming