From: Andres Freund <andres@anarazel.de>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Add test of various escape functions
Date: Mon, 10 Feb 2025 15:09:49 +0000
Message-ID: <E1thVPx-006Nyl-30@gemulon.postgresql.org> (raw)
Add test of various escape functions
As highlighted by the prior commit, writing correct escape functions is less
trivial than one might hope.
This test module tries to verify that different escaping functions behave
reasonably. It e.g. tests:
- Invalidly encoded input to an escape function leads to invalidly encoded
output
- Trailing incomplete multi-byte characters are handled sensibly
- Escaped strings are parsed as single statement by psql's parser (which
derives from the backend parser)
There are further tests that would be good to add. But even in the current
state it was rather useful for writing the fix in the prior commit.
Reviewed-by: Noah Misch <noah@leadboat.com>
Backpatch-through: 13
Security: CVE-2025-1094
Branch
------
REL_13_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/4ea3f5ef35f0d4aff89230eed63b76574b629f83
Modified Files
--------------
src/test/modules/Makefile | 1 +
src/test/modules/test_escape/.gitignore | 2 +
src/test/modules/test_escape/Makefile | 27 +
src/test/modules/test_escape/t/001_test_escape.pl | 53 ++
src/test/modules/test_escape/test_escape.c | 803 ++++++++++++++++++++++
src/tools/msvc/Mkvcbuild.pm | 3 +-
src/tools/pgindent/typedefs.list | 3 +
7 files changed, 891 insertions(+), 1 deletion(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: andres@anarazel.de, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Add test of various escape functions
In-Reply-To: <E1thVPx-006Nyl-30@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox