From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Ensure Soundex difference() function handles empty input sanely.
Date: Tue, 16 May 2023 14:54:01 +0000
Message-ID: <E1pyw3t-0007od-IP@gemulon.postgresql.org> (raw)
Ensure Soundex difference() function handles empty input sanely.
fuzzystrmatch's difference() function assumes that _soundex()
always initializes its output buffer fully. This was not so for
the case of a string containing no alphabetic characters, resulting
in unstable output and Valgrind complaints.
Fix by using memset() to fill the whole buffer in the early-exit
case. Also make some cosmetic improvements (I didn't care for the
random switches between "instr[0]" and "*instr" notation).
Report and diagnosis by Alexander Lakhin (bug #17935).
Back-patch to all supported branches.
Discussion: https://postgr.es/m/17935-b99316aa79c18513@postgresql.org
Branch
------
REL_11_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/8084bf9a493d577bb2d0d902388ed3fd48859c05
Modified Files
--------------
contrib/fuzzystrmatch/expected/fuzzystrmatch.out | 6 ++++++
contrib/fuzzystrmatch/fuzzystrmatch.c | 15 ++++++++-------
contrib/fuzzystrmatch/sql/fuzzystrmatch.sql | 1 +
3 files changed, 15 insertions(+), 7 deletions(-)
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: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Ensure Soundex difference() function handles empty input sanely.
In-Reply-To: <E1pyw3t-0007od-IP@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