pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Gierth <rhodiumtoad@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: pg_trgm: fix crash in 2-item picksplit
Date: Thu, 12 Nov 2020 16:01:46 +0000
Message-ID: <E1kdF2g-0003cv-24@gemulon.postgresql.org> (raw)

pg_trgm: fix crash in 2-item picksplit

Whether from size overflow in gistSplit or from secondary splits,
picksplit is (rarely) called with exactly two items to split.

Formerly, due to special-case handling of the last item, this would
lead to access to an uninitialized cache entry; prior to PG 13 this
might have been harmless or at worst led to an incorrect union datum,
but in 13 onwards it can cause a backend crash from using an
uninitialized pointer.

Repair by removing the special case, which was deemed not to have been
appropriate anyway. Backpatch all the way, because this bug has
existed since pg_trgm was added.

Per report on IRC from user "ftzdomino". Analysis and testing by me,
patch from Alexander Korotkov.

Discussion: https://postgr.es/m/87k0usfdxg.fsf@news-spur.riddles.org.uk

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/7f69ed4aebe342365dc7db96f33b473dec9f054b

Modified Files
--------------
contrib/pg_trgm/trgm_gist.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)



view thread (7+ messages)  latest in thread

Message-ID: <E1kdF2g-0003cv-24@gemulon.postgresql.org>
Permalink:  ../E1kdF2g-0003cv-24@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1kdF2g-0003cv-24@gemulon.postgresql.org

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: rhodiumtoad@postgresql.org
  Subject: Re: pgsql: pg_trgm: fix crash in 2-item picksplit
  In-Reply-To: <E1kdF2g-0003cv-24@gemulon.postgresql.org>
  References: <E1kdF2g-0003cv-24@gemulon.postgresql.org>

* 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