public inbox for [email protected]  
help / color / mirror / Atom feed
From: Peter Geoghegan <[email protected]>
To: Postgress Cybrosys <[email protected]>
Cc: [email protected]
Subject: Re: Fix type of 'reduction' variable in _bt_singleval_fillfactor()
Date: Thu, 19 Mar 2026 18:09:07 -0400
Message-ID: <CAH2-Wz=KCRgu=8Wh3L7OW1dwHr3QzDJNff4B2gi2JG3Gz0p-+g@mail.gmail.com> (raw)
In-Reply-To: <CAG+=MFWUyr3pjHk32z6LqiTmULw_1cuje7c8bnQnd+nKPRM54Q@mail.gmail.com>
References: <CAG+=MFWUyr3pjHk32z6LqiTmULw_1cuje7c8bnQnd+nKPRM54Q@mail.gmail.com>

On Thu, Mar 19, 2026 at 1:57 AM Postgress Cybrosys
<[email protected]> wrote:
> While no overflow occurs with current BLCKSZ limits (the product is
> at most ~30KB on a standard build, well within INT_MAX), the type
> mismatch could silently produce incorrect behaviour on non-standard
> builds compiled with a very large BLCKSZ.

We don't support BLCKSZ greater than 32KiB. Fields like
ItemIdData.lp_len only have space for 15 bits (independent of BLCKSZ
itself). Many places (likely thousands) rely on that limit.

> In that case, if the
> product exceeded INT_MAX, 'reduction' would wrap to a large negative
> number. The subsequent check:
>
>     if (state->maxpostingsize > reduction)
>         state->maxpostingsize -= reduction;
>
> would then subtract a negative value, i.e. increase maxpostingsize
> instead of reducing it, silently defeating the single-value fill
> strategy entirely.

This cannot happen with any supported BLCKSZ. Even if we wanted to
support larger BLCKSZ builds, why start here?

-- 
Peter Geoghegan





view thread (2+ messages)

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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Fix type of 'reduction' variable in _bt_singleval_fillfactor()
  In-Reply-To: <CAH2-Wz=KCRgu=8Wh3L7OW1dwHr3QzDJNff4B2gi2JG3Gz0p-+g@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox