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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alexander Lakhin <exclusion(at)gmail(dot)com>
Cc: Andrey Rachitskiy <pl0h0yp1(at)gmail(dot)com>, 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:04:07
Message-ID: 445119.1788062647@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Alexander Lakhin <exclusion(at)gmail(dot)com> writes:
> I discovered one more issue in this area. This OOM condition emulation:
> --- a/src/backend/snowball/libstemmer/api.c
> +++ b/src/backend/snowball/libstemmer/api.c
> @@ -6,3 +6,3 @@ extern struct SN_env * SN_new_env(int alloc_size)
>  {
> -    struct SN_env * z = (struct SN_env *) malloc(alloc_size);
> +    struct SN_env * z = (rand() % 2 == 0) ? NULL : (struct SN_env *) malloc(alloc_size);
>      if (z == NULL) return NULL;

> leads to `make check` crashes like:

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?

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next 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
Previous Message Alexander Lakhin 2026-08-30 04:00:00 Re: BUG #19595: Three memory-safety defects in src/backend/tsearch/spell.c (dictionary loader), PG 18.3