Re: BUG #19920: Out-of-Bounds Read on a Zero-Length Array in pg_trgm word_similarity('', '')

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: nakamurajames123(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19920: Out-of-Bounds Read on a Zero-Length Array in pg_trgm word_similarity('', '')
Date: 2026-11-19 11:53:22
Message-ID: 94A12932-3BE5-4DAF-91E9-E57861FC4278@yesql.se
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

> On 19 Nov 2026, at 02:33, PG Bug reporting form <noreply(at)postgresql(dot)org> wrote:

> In calc_word_similarity(), an array is allocated with zero elements, but the
> function reads found[0], accessing one byte outside the allocated array
> bounds.

Verified, the trivial diff attached avoids this.

--
Daniel Gustafsson

Attachment Content-Type Size
pg_trgm_check_len.diff application/octet-stream 412 bytes

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Andrey Rachitskiy 2026-11-19 11:55:13 Re: BUG #19918: SIGSEGV in auto_explain + EXPLAIN (BUFFERS)
Previous Message Henson Choi 2026-11-19 07:22:28 Re: BUG #19911: Window aggregate over ROWS n FOLLOWING: "unexpected end of tuplestore" after spill