pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: shihao zhong <zhong950419@gmail.com>
Cc: exclusion@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #19780: gtsvector_picksplit() reads uninitialized data when called with three entries
Date: Fri, 6 Nov 2026 16:52:21 +0900
Message-ID: <au2HNfBBz9haENO4@paquier.xyz> (raw)
In-Reply-To: <CAGRkXqTnM1a9o9raz-3qZfHagf_An5fyyNdb7=uTAREpQ9Md4w@mail.gmail.com>
References: <19780-93fb5c0e4ec2af18@postgresql.org>
	<CAGRkXqTnM1a9o9raz-3qZfHagf_An5fyyNdb7=uTAREpQ9Md4w@mail.gmail.com>

On Wed, Nov 04, 2026 at 12:42:55AM -0500, shihao zhong wrote:
> Thanks for the report. With only two entries, the cache of the second
> one is used before it is filled.
> 
> Your two column case is harmless. With one column, the index can miss
> rows until REINDEX.
> 
> The attached patch fills the cache earlier and adds a test.

So the problem is this one, where we could try to read the cached data
for seed_2 but it's just not initialized yet:
datum_r = gtsvector_alloc(SIGNKEY | (cache[seed_2].allistrue ?
    ALLISTRUE : 0), siglen, cache[seed_2].sign);                                                                                                                   

Calling fillcache() earlier so as datum_r and datum_l are built from
correct values is enough.  Your change makes sense.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

view thread (8+ messages)  latest in thread

Message-ID: <au2HNfBBz9haENO4@paquier.xyz>
Permalink:  ../au2HNfBBz9haENO4@paquier.xyz/
Also on:    postgresql.org/message-id/au2HNfBBz9haENO4@paquier.xyz

 · 

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-bugs@postgresql.org
  Cc: michael@paquier.xyz, zhong950419@gmail.com, exclusion@gmail.com
  Subject: Re: BUG #19780: gtsvector_picksplit() reads uninitialized data when called with three entries
  In-Reply-To: <au2HNfBBz9haENO4@paquier.xyz>
  References: <19780-93fb5c0e4ec2af18@postgresql.org> <CAGRkXqTnM1a9o9raz-3qZfHagf_An5fyyNdb7=uTAREpQ9Md4w@mail.gmail.com> <au2HNfBBz9haENO4@paquier.xyz>

* 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