pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andrey Rachitskiy <pl0h0yp1@gmail.com>
Cc: Alexander Lakhin <exclusion@gmail.com>
Cc: michaelmalis2@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #19595: Three memory-safety defects in src/backend/tsearch/spell.c (dictionary loader), PG 18.3
Date: Sun, 30 Aug 2026 11:14:03 -0400
Message-ID: <491621.1788102843@sss.pgh.pa.us> (raw)
In-Reply-To: <CAB8bMiu0TR3nr6osp8t8ZvjeZR-ve_tMNsUTqOKfCgkNuzvtJg@mail.gmail.com>
References: <19595-7dc18b4e212c4757@postgresql.org>
	<CAB8bMiun+cTqTnv-cTfxvTbnOLxWunRgyZeUZ88YMSLLXub4mg@mail.gmail.com>
	<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>
	<CAB8bMiu_ygyi2dOfObf9i2=-b4Phokm+c18atW2C8GWcEj842w@mail.gmail.com>
	<CAB8bMit+ARmO25cBKJRkFcGK1Dwe54CvgUc0yOHwgnvSD6iO2w@mail.gmail.com>
	<CAB8bMiu0TR3nr6osp8t8ZvjeZR-ve_tMNsUTqOKfCgkNuzvtJg@mail.gmail.com>

Andrey Rachitskiy <pl0h0yp1@gmail.com> 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






view thread (15+ messages)

Message-ID: <491621.1788102843@sss.pgh.pa.us>
Permalink:  ../491621.1788102843@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/491621.1788102843@sss.pgh.pa.us

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pl0h0yp1@gmail.com, exclusion@gmail.com, 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: <491621.1788102843@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox