From: | Joseph Koshakow <koshy44(at)gmail(dot)com> |
---|---|
To: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Fix overflow in pg_size_pretty |
Date: | 2024-07-27 19:18:00 |
Message-ID: | CAAvxfHdTsMZPWEHUrZ=h3cky9Ccc3Mtx2whUHygY+ABP-mCmUw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi all,
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.
The pg_abs_s64() helper function is extracted and simplified from patch
0001 from [0]. I didn't add similar functions for other sized integers
since they'd be unused, but I'd be happy to add them if others
disagree.
`SELECT -9223372036854775808::bigint` results in an out of range error,
even though `-9223372036854775808` can fit in a `bigint` and
`SELECT pg_typeof(-9223372036854775808)` returns `bigint`. That's why
the `::bigint` cast is omitted from my test.
Thanks,
Joseph Koshakow
Attachment | Content-Type | Size |
---|---|---|
v1-0001-Fix-overflow-in-pg_size_pretty.patch | text/x-patch | 3.2 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2024-07-27 19:18:43 | Re: Protocol question regarding Portal vs Cursor |
Previous Message | Andreas Karlsson | 2024-07-27 19:03:20 | Re: tiny step toward threading: reduce dependence on setlocale() |