From b464e51ab32fbf09cf5d9c911a8e26f491ad1f44 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 18 Feb 2025 21:13:46 -0500 Subject: Update to latest Snowball sources. It's been some time since we did this, partly because the upstream snowball project hasn't formally tagged a new release since 2021. The main motivation for doing it now is to absorb a bug fix (their commit e322673a841d9abd69994ae8cd20e191090b6ef4), which prevents a null pointer dereference crash if SN_create_env() gets a malloc failure at just the wrong point. We'll patch the back branches with only that change, but we might as well do the full sync dance on HEAD. Aside from a bunch of mostly-minor tweaks to existing stemmers, this update adds a new stemmer for Estonian. It also removes the existing stemmer for Romanian using ISO-8859-2 encoding. Upstream apparently concluded that ISO-8859-2 doesn't provide an adequate representation of some Romanian characters, and the UTF-8 implementation should be used instead. While at it, update the README's instructions for doing a sync, which have not been adjusted during the addition of meson tooling. Thanks to Maksim Korotkov for discovering the null-pointer bug and submitting the fix to upstream snowball. Reported-by: Maksim Korotkov Discussion: https://postgr.es/m/1d1a46-67ab1000-21-80c451@83151435 --- src/backend/snowball/libstemmer/utilities.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/backend/snowball/libstemmer/utilities.c') diff --git a/src/backend/snowball/libstemmer/utilities.c b/src/backend/snowball/libstemmer/utilities.c index 1ecd2410fe7..8acc18541d5 100644 --- a/src/backend/snowball/libstemmer/utilities.c +++ b/src/backend/snowball/libstemmer/utilities.c @@ -281,7 +281,7 @@ extern int find_among(struct SN_env * z, const struct among * v, int v_size) { w = v + i; if (common_i >= w->s_size) { z->c = c + w->s_size; - if (w->function == 0) return w->result; + if (w->function == NULL) return w->result; { int res = w->function(z); z->c = c + w->s_size; @@ -336,7 +336,7 @@ extern int find_among_b(struct SN_env * z, const struct among * v, int v_size) { w = v + i; if (common_i >= w->s_size) { z->c = c - w->s_size; - if (w->function == 0) return w->result; + if (w->function == NULL) return w->result; { int res = w->function(z); z->c = c - w->s_size; @@ -429,7 +429,7 @@ extern int slice_from_v(struct SN_env * z, const symbol * p) { } extern int slice_del(struct SN_env * z) { - return slice_from_s(z, 0, 0); + return slice_from_s(z, 0, NULL); } extern int insert_s(struct SN_env * z, int bra, int ket, int s_size, const symbol * s) { -- cgit v1.2.3