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 <[email protected]> Backpatch-through: 14 Security: CVE-2026-116315 Branch ------ REL_14_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/d681b9f6a53b7b34798aeb069e038456a90c9ebe Author: Tom Lane <[email protected]> Modified Files -------------- src/backend/utils/adt/tsvector_op.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-)
