Re: Possible integer overflow in bringetbitmap()

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: James Hunter <james(dot)hunter(dot)pg(at)gmail(dot)com>
Cc: Evgeniy Gorbanyov <gorbanyoves(at)basealt(dot)ru>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Possible integer overflow in bringetbitmap()
Date: 2024-12-05 06:13:14
Message-ID: Z1FEehRQTTbqwm1Q@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Dec 04, 2024 at 02:05:10PM -0800, James Hunter wrote:
> So, I think your patch should be, instead, to cast either "totalpages"
> or "10" to "int64", in the return statement.

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..
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2024-12-05 06:41:55 Re: simplify regular expression locale global variables
Previous Message Ravi 2024-12-05 05:52:07 Re: [PERF] Improve Cardinality Estimation for Joins with GROUP BY Having Single Clause