diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2023-05-16 10:53:42 -0400 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2023-05-16 10:53:42 -0400 |
| commit | 0409c7fc746b2597edeaab3132d3f3554660283d (patch) | |
| tree | eff7b95d87409cabdf1f1202eb3e162cf856f438 /contrib/fuzzystrmatch/expected/fuzzystrmatch.out | |
| parent | 71fe2372278760714a442c82eb2ef524b7ea392a (diff) | |
| download | postgresql-0409c7fc746b2597edeaab3132d3f3554660283d.tar.gz | |
Ensure Soundex difference() function handles empty input sanely.REL_13_STABLE
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
Diffstat (limited to 'contrib/fuzzystrmatch/expected/fuzzystrmatch.out')
| -rw-r--r-- | contrib/fuzzystrmatch/expected/fuzzystrmatch.out | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/contrib/fuzzystrmatch/expected/fuzzystrmatch.out b/contrib/fuzzystrmatch/expected/fuzzystrmatch.out index 493c95cdfa..2827e81eb4 100644 --- a/contrib/fuzzystrmatch/expected/fuzzystrmatch.out +++ b/contrib/fuzzystrmatch/expected/fuzzystrmatch.out @@ -23,6 +23,12 @@ SELECT soundex('Anne'), soundex('Margaret'), difference('Anne', 'Margaret'); A500 | M626 | 0 (1 row) +SELECT soundex(''), difference('', ''); + soundex | difference +---------+------------ + | 4 +(1 row) + SELECT levenshtein('GUMBO', 'GAMBOL'); levenshtein ------------- |
