Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1x0hEe-004lVJ-2b for pgsql-bugs@arkaria.postgresql.org; Sun, 30 Aug 2026 15:14:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1x0hEd-00Dedr-2e for pgsql-bugs@arkaria.postgresql.org; Sun, 30 Aug 2026 15:14:15 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1x0hEd-00Dedj-1o for pgsql-bugs@lists.postgresql.org; Sun, 30 Aug 2026 15:14:15 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1x0hEa-000000023AI-4AJh for pgsql-bugs@lists.postgresql.org; Sun, 30 Aug 2026 15:14:15 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.18.1/8.18.1) with ESMTP id 67UFE3hE491622; Sun, 30 Aug 2026 11:14:03 -0400 From: Tom Lane To: Andrey Rachitskiy cc: Alexander Lakhin , michaelmalis2@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #19595: Three memory-safety defects in src/backend/tsearch/spell.c (dictionary loader), PG 18.3 In-reply-to: References: <19595-7dc18b4e212c4757@postgresql.org> <325748.1785691547@sss.pgh.pa.us> <0f3ddeb5-0dbd-479c-9d0e-ae254758e624@gmail.com> <336527.1785701494@sss.pgh.pa.us> <2ab10d25-7dc6-4914-8aea-ca0adfbe57c3@gmail.com> <445119.1788062647@sss.pgh.pa.us> <6e7563f0-48df-4639-b263-f04bc23c876b@gmail.com> Comments: In-reply-to Andrey Rachitskiy message dated "Sun, 30 Aug 2026 16:43:32 +0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <491620.1788102843.1@sss.pgh.pa.us> Date: Sun, 30 Aug 2026 11:14:03 -0400 Message-ID: <491621.1788102843@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andrey Rachitskiy writes: > In the backend, snowball_runtime.h remaps malloc to palloc > (src/include/snowball/snowball_runtime.h). api.c includes that > header via the -I order in the snowball Makefile / meson.build, so > SN_new_env()'s malloc is palloc. On allocation failure palloc does > not return NULL. It goes through MemoryContextAllocationFailure(). Ah, right. You can confirm that SN_new_env is really using palloc: $ nm --ext --undef api.o | grep alloc U palloc It's like this to prevent memory leaks while not modifying the machine-generated Snowball .c files, but I concede it's confusing. Anyway it looks like we have nothing to do here. The Snowball code is correct on its own terms to defend against null results, but our calling code is equally correct to not worry about that. regards, tom lane