pgsql: Tighten up tsqueryrecv().

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Tighten up tsqueryrecv().
Date: 2026-08-17 22:18:09
Message-ID: E1ww5ei-00000000yb7-14w7@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Tighten up tsqueryrecv().

tsqueryrecv() accepted zero-length lexemes, which tsqueryin() doesn't.
It also accepted phrase distance values larger than MAXENTRYPOS,
which tsqueryin() doesn't. While neither of these omissions are
very harmful in themselves, they do allow accepting tsquery values
that will fail in a subsequent textual dump/reload.

Commit 23d9ad771 performed similar tightening of tsvectorrecv(),
but I left off these changes at the time because they didn't seem
to have security implications.

Reported-by: Claude Code (via Noah Misch)
Author: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Reviewed-by: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Discussion: https://postgr.es/m/455079.1786897319@sss.pgh.pa.us
Backpatch-through: 14

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/df8b91463740202caa14c9e968fb8cfa7f4f01b0

Modified Files
--------------
src/backend/utils/adt/tsquery.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Jeff Davis 2026-08-18 01:06:34 pgsql: pg_locale.c: Fix REL_18_STABLE for srclen < 0.
Previous Message Peter Geoghegan 2026-08-17 21:31:27 pgsql: GiST: Deprecate F_TUPLES_DELETED opaque area flag.