Re: BUG #19595: Three memory-safety defects in src/backend/tsearch/spell.c (dictionary loader), PG 18.3

From: Andrey Rachitskiy <pl0h0yp1(at)gmail(dot)com>
To: Alexander Lakhin <exclusion(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, michaelmalis2(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19595: Three memory-safety defects in src/backend/tsearch/spell.c (dictionary loader), PG 18.3
Date: 2026-08-30 04:37:50
Message-ID: CAB8bMiu_ygyi2dOfObf9i2=-b4Phokm+c18atW2C8GWcEj842w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

вс, 30 авг. 2026 г. в 09:30, Alexander Lakhin <exclusion(at)gmail(dot)com>:

> 30.08.2026 07:04, Tom Lane wrote:
>
> Hmph. SN_new_env itself is visibly okay with this, so the failure is
> in some caller. I'm too tired to dig into it myself, but can you
> identify the culprit more precisely?
>
>
> I think it's:
> static void
> locate_stem_module(DictSnowball *d, const char *lang)
> {
> ...
> d->stem = m->stem;
> d->z = m->create();
> ...
> (in two places)
>
> then d->z is dereferenced in dsnowball_lexize().
>
> Confirm.
locate_stem_module() in dict_snowball.c stores m->create() into d->z
without checking. *_create_env wrappers correctly return NULL when
SN_new_env fails. dsnowball_init then succeeds with d->z == NULL, and
dsnowball_lexize crashes in SN_set_current / replace_s.

--
Regards,
Rachitskiy Andrey

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Andrey Rachitskiy 2026-08-30 04:43:38 Re: BUG #19595: Three memory-safety defects in src/backend/tsearch/spell.c (dictionary loader), PG 18.3
Previous Message Alexander Lakhin 2026-08-30 04:30:00 Re: BUG #19595: Three memory-safety defects in src/backend/tsearch/spell.c (dictionary loader), PG 18.3