Re: Fix overflow in pg_size_pretty

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Joseph Koshakow <koshy44(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Fix overflow in pg_size_pretty
Date: 2024-07-27 22:28:23
Message-ID: CAApHDvr421-9UK+BKfwKyZxn5XhbTLOJXppnAgkPqpCJQcoCCQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, 28 Jul 2024 at 07:18, Joseph Koshakow <koshy44(at)gmail(dot)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 Content-Type Size
pg_size_pretty_bigint_fix.patch application/octet-stream 635 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2024-07-27 22:43:55 Re: why is pg_upgrade's regression run so slow?
Previous Message Andreas Karlsson 2024-07-27 22:14:56 Re: Speed up collation cache