Re: pg_stat_get_activity(): integer overflow due to (int) * (int) for MemoryContextAllocHuge()

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Jakub Wartak <jakub(dot)wartak(at)enterprisedb(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Subject: Re: pg_stat_get_activity(): integer overflow due to (int) * (int) for MemoryContextAllocHuge()
Date: 2023-09-27 08:08:23
Message-ID: ZRPi9xOBFoTJ5rTb@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Sep 27, 2023 at 08:41:55AM +0200, Jakub Wartak wrote:
> Attached patch adjusts pgstat_track_activity_query_size to be of
> size_t from int and fixes the issue.

This cannot be backpatched, and using size_t is not really needed as
track_activity_query_size is capped at 1MB. Why don't you just tweak
the calculation done in pgstat_read_current_status() instead, say with
a cast?
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2023-09-27 08:14:48 Re: logfmt and application_context
Previous Message David Rowley 2023-09-27 08:03:43 Re: make add_paths_to_append_rel aware of startup cost