pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Fujii Masao <fujii@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix pgstat_report_replslot() to use proper data types for its ar
Date: Fri, 02 Apr 2021 08:28:33 +0000
Message-ID: <E1lSFAP-0000OW-CH@gemulon.postgresql.org> (raw)

Fix pgstat_report_replslot() to use proper data types for its arguments.

The caller of pgstat_report_replslot() passes int64 values to the function.
Also the function stores those values in PgStat_Counter (i.e., int64) fields
of PgStat_MsgReplSlot struct. But previously the function used "int" as
the data types of some arguments for those values, which could lead to
the overflow of values.

To avoid this risk, this commit fixes pgstat_report_replslot() to use
PgStat_Counter type for the arguments. Since they are the statistics counters,
PgStat_Counter, the data type used for counters, is used for them
instead of int64.

Reported-by: Vignesh C
Author: Vignesh C
Reviewed-by: Jeevan Ladhe, Fujii Masao
Discussion: https://postgr.es/m/CALDaNm080OpG=ZwOb0i8EyChH5SyHAMFWJCKaKTXmrfvJLbgaA@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/96bdb7e19de80a0c9521c5696455bca2a685c919

Modified Files
--------------
src/backend/postmaster/pgstat.c | 6 ++++--
src/include/pgstat.h            | 6 ++++--
2 files changed, 8 insertions(+), 4 deletions(-)



Message-ID: <E1lSFAP-0000OW-CH@gemulon.postgresql.org>
Permalink:  ../E1lSFAP-0000OW-CH@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1lSFAP-0000OW-CH@gemulon.postgresql.org

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: fujii@postgresql.org
  Subject: Re: pgsql: Fix pgstat_report_replslot() to use proper data types for its ar
  In-Reply-To: <E1lSFAP-0000OW-CH@gemulon.postgresql.org>
  References: <E1lSFAP-0000OW-CH@gemulon.postgresql.org>

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

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