Skip to content

Commit 197427f

Browse files
committed
Avoid null pointer dereference crash after OOM in Snowball stemmers.
Absorb upstream 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. Thanks to Maksim Korotkov for discovering the null-pointer bug and submitting the fix to upstream snowball. Reported-by: Maksim Korotkov <m.korotkov@postgrespro.ru> Author: Maksim Korotkov <m.korotkov@postgrespro.ru> Discussion: https://postgr.es/m/1d1a46-67ab1000-21-80c451@83151435 Backpatch-through: 13
1 parent a38a7ad commit 197427f

File tree

1 file changed

+1
-1
lines changed
  • src/backend/snowball/libstemmer

1 file changed

+1
-1
lines changed

src/backend/snowball/libstemmer/api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ extern struct SN_env * SN_create_env(int S_size, int I_size, int B_size)
4040
extern void SN_close_env(struct SN_env * z, int S_size)
4141
{
4242
if (z == NULL) return;
43-
if (S_size)
43+
if (z->S)
4444
{
4545
int i;
4646
for (i = 0; i < S_size; i++)

0 commit comments

Comments
 (0)