From: Noah Misch <noah@leadboat.com>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Protect against miscalculation of tuple sizes via int32 overflow
Date: Mon, 09 Nov 2026 14:21:55 +0000
Message-ID: <E1xQQFv-000000003Wn-2pMj@gemulon.postgresql.org> (raw)
Protect against miscalculation of tuple sizes via int32 overflow
In-memory tuple sizes were being calculated in 64-bit-sized variables
and later assigned to 32-bit variables, potentially leading to integer
wraparound, which could then be used to overwrite server memory with
attacker-controlled contents. Repair by using overflow-aware addition
and, for additions done in loops, checking that the result complies with
the 1GB palloc limit at each step.
Reported-by: Hillai Ben Sasson <hillai.bensasson@wiz.io>
Reported-by: Jayden Sarveshkumar <jayden@verialabs.com>
Reported-by: Mehmet Ince <mehmet@mehmetince.net>
Author: Álvaro Herrera <alvherre@kurilemu.de>
Reviewed-by: Tatsuo Ishii <ishii@postgresql.org>
Security: CVE-2026-120139
Backpatch-through: 14
Branch
------
REL_19_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/01cdd163c86ffe6f4426973e8ecdc6389312731c
Author: Álvaro Herrera <alvherre@kurilemu.de>
Modified Files
--------------
src/backend/access/common/heaptuple.c | 59 +++++++++++++++++++++++++++++----
src/backend/access/heap/heaptoast.c | 20 ++++++-----
src/backend/executor/execTuples.c | 5 +++
src/backend/utils/adt/array_userfuncs.c | 3 +-
src/backend/utils/adt/multirangetypes.c | 7 ++++
src/include/access/htup_details.h | 4 +++
src/include/access/tupmacs.h | 30 +++++++++++++++++
7 files changed, 112 insertions(+), 16 deletions(-)
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: noah@leadboat.com
Subject: Re: pgsql: Protect against miscalculation of tuple sizes via int32 overflow
In-Reply-To: <E1xQQFv-000000003Wn-2pMj@gemulon.postgresql.org>
References: <E1xQQFv-000000003Wn-2pMj@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