agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
From: Noah Misch <noah@leadboat.com>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Avoid overflow in size calculations in formatting.c.
Date: Mon, 11 May 2026 12:19:38 +0000
Message-ID: <E1wMPbm-0002YN-2F@gemulon.postgresql.org> (raw)

Avoid overflow in size calculations in formatting.c.

A few functions in this file were incautious about multiplying a
possibly large integer by a factor more than 1 and then using it as
an allocation size.  This is harmless on 64-bit systems where we'd
compute a size exceeding MaxAllocSize and then fail, but on 32-bit
systems we could overflow size_t, leading to an undersized
allocation and buffer overrun.  To fix, use palloc_array() or
mul_size() instead of handwritten multiplication.

Reported-by: Sven Klemm <sven@tigerdata.com>
Reported-by: Xint Code
Author: Nathan Bossart <nathandbossart@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Tatsuo Ishii <ishii@postgresql.org>
Security: CVE-2026-6473
Backpatch-through: 14

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/87357a606ebbf60927a9ce4a47dccbc293821cd3
Author: Nathan Bossart <nathan@postgresql.org>

Modified Files
--------------
src/backend/utils/adt/formatting.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)



view thread (6+ messages)  latest in thread

Message-ID: <E1wMPbm-0002YN-2F@gemulon.postgresql.org>
Permalink:  ../E1wMPbm-0002YN-2F@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1wMPbm-0002YN-2F@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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: noah@leadboat.com, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Avoid overflow in size calculations in formatting.c.
  In-Reply-To: <E1wMPbm-0002YN-2F@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 agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox