pgsql: Code coverage for most pg_mblen* calls.

From: Thomas Munro <tmunro(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Code coverage for most pg_mblen* calls.
Date: 2026-02-09 00:07:34
Message-ID: E1vpEoP-001x28-2K@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Code coverage for most pg_mblen* calls.

A security patch changed them today, so close the coverage gap now.
Test that buffer overrun is avoided when pg_mblen*() requires more
than the number of bytes remaining.

This does not cover the calls in dict_thesaurus.c or in dict_synonym.c.
That code is straightforward. To change that code's input, one must
have access to modify installed OS files, so low-privilege users are not
a threat. Testing this would likewise require changing installed
share/postgresql/tsearch_data, which was enough of an obstacle to not
bother.

Security: CVE-2026-2006
Backpatch-through: 14
Co-authored-by: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Co-authored-by: Noah Misch <noah(at)leadboat(dot)com>
Reviewed-by: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/10ebc4bd67ec46009e18215e77347390b29d70b3

Modified Files
--------------
contrib/pg_trgm/Makefile | 2 +-
contrib/pg_trgm/data/trgm_utf8.data | 50 ++++
contrib/pg_trgm/expected/pg_utf8_trgm.out | 8 +
contrib/pg_trgm/expected/pg_utf8_trgm_1.out | 3 +
contrib/pg_trgm/meson.build | 1 +
contrib/pg_trgm/sql/pg_utf8_trgm.sql | 9 +
src/backend/utils/adt/arrayfuncs.c | 6 +
src/test/regress/expected/encoding.out | 401 ++++++++++++++++++++++++++++
src/test/regress/expected/encoding_1.out | 4 +
src/test/regress/expected/euc_kr.out | 16 ++
src/test/regress/expected/euc_kr_1.out | 6 +
src/test/regress/parallel_schedule | 2 +-
src/test/regress/regress.c | 139 ++++++++++
src/test/regress/sql/encoding.sql | 228 ++++++++++++++++
src/test/regress/sql/euc_kr.sql | 12 +
15 files changed, 885 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Thomas Munro 2026-02-09 00:07:46 pgsql: Replace pg_mblen() with bounds-checked versions.
Previous Message Thomas Munro 2026-02-09 00:07:19 pgsql: Fix encoding length for EUC_CN.