[PATCH] snowball: fix potential NULL dereference

m.korotkov@postgrespro.ru

From: Коротков Максим <m.korotkov@postgrespro.ru>
To: pgsql-hackers@postgresql.org
Date: 2025-02-11T08:52:29Z
Lists: pgsql-hackers

Attachments

Hi all,
I found the case of potential NULL pointer dereference.
In snowball/libstemmer/api.c if we transfer control to the SN_create_env() function
by using the error label when there is a memory allocation error of z->p or z->S,
we can then dereference the NULL pointer z->S in the function SN_close_env().
Added the pointer check for avoiding a potential problem.
---
Best regards, Korotkov Maksim
PostgresPro
m.korotkov@postgrespro.ru

Commits

  1. Avoid null pointer dereference crash after OOM in Snowball stemmers.

  2. Update to latest Snowball sources.