Re: Possible integer overflow in bringetbitmap() - Mailing list pgsql-hackers

From James Hunter
Subject Re: Possible integer overflow in bringetbitmap()
Date
Msg-id CAJVSvF7vqexnSu9PRF_gDKFqgyR3qtG-L885s1wA+kn3t+euKg@mail.gmail.com
Whole thread Raw
In response to Re: Possible integer overflow in bringetbitmap()  (James Hunter <james.hunter.pg@gmail.com>)
List pgsql-hackers
On Wed, Dec 4, 2024 at 10:13 PM Michael Paquier <michael@paquier.xyz> wrote:
>
> totalpages is signed, and BlockNumber is unsigned.  Hence in theory
> you could always fall into a trap once totalpages gets higher than
> (2^31 - 1), no?  This is not going to be a problem in practice even if
> the number of pages per range assigned to brin can be 1, still..

Good point -- so the fix should be something like: (a) make totalpages
a BlockNumber or uint32; (b) cast either "totalpages" or "10" to
int64, before returning the result?

James



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: code contributions for 2024, WIP version
Next
From: Francesco Degrassi
Date:
Subject: Re: RFC/PoC: GUC option to enable tuple queue autoflush for parallel workers