Re: Fix overflow in pg_size_pretty - Mailing list pgsql-hackers

From David Rowley
Subject Re: Fix overflow in pg_size_pretty
Date
Msg-id CAApHDvr421-9UK+BKfwKyZxn5XhbTLOJXppnAgkPqpCJQcoCCQ@mail.gmail.com
Whole thread Raw
In response to Fix overflow in pg_size_pretty  (Joseph Koshakow <koshy44@gmail.com>)
Responses Re: Fix overflow in pg_size_pretty
List pgsql-hackers
On Sun, 28 Jul 2024 at 07:18, Joseph Koshakow <koshy44@gmail.com> wrote:
> Attached is a patch that resolves an overflow in pg_size_pretty() that
> resulted in unexpected behavior when PG_INT64_MIN was passed in as an
> argument.

Could we just fix this more simply by assigning the absolute value of
the signed variable into an unsigned type?  It's a bit less code and
gets rid of the explicit test for PG_INT64_MIN.

David

Attachment

pgsql-hackers by date:

Previous
From: Andreas Karlsson
Date:
Subject: Re: Speed up collation cache
Next
From: Andrew Dunstan
Date:
Subject: Re: why is pg_upgrade's regression run so slow?