Re: pg_stat_get_activity(): integer overflow due to (int) * (int) for MemoryContextAllocHuge() - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: pg_stat_get_activity(): integer overflow due to (int) * (int) for MemoryContextAllocHuge()
Date
Msg-id ZRu-AXPfGV3wM4iu@paquier.xyz
Whole thread Raw
In response to Re: pg_stat_get_activity(): integer overflow due to (int) * (int) for MemoryContextAllocHuge()  (Jakub Wartak <jakub.wartak@enterprisedb.com>)
List pgsql-hackers
On Mon, Oct 02, 2023 at 10:22:06AM +0200, Jakub Wartak wrote:
> I've attached v4 that covers your suggestions.

Hmm.  I was looking at all that and pondered quite a bit about the
addition of the restriction when starting up the server, particularly
why there would be any need to include it in the same commit as the
one fixing the arguments given to AllocHuge().  At the end, as the
restriction goes a bit against 8d0ddccec636, I have removed it and
went to the simplest solution of adding the casts to Size, which is
the same thing as we do in all the other callers that deal with signed
variables (like mbutils.c).

Regarding any restrictions, perhaps we should improve the docs, at
least.  It would be better to discuss that separately.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Peter Smith
Date:
Subject: Re: Invalidate the subscription worker in cases where a user loses their superuser status
Next
From: David Rowley
Date:
Subject: Re: pg16: XX000: could not find pathkey item to sort