pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Protect against miscalculation of tuple sizes via int32 overflow
3+ messages / 1 participants
[nested] [flat]

* pgsql: Protect against miscalculation of tuple sizes via int32 overflow
@ 2026-11-09 14:21  Noah Misch <noah@leadboat.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Noah Misch @ 2026-11-09 14:21 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/7bb89dbfde47ee773fe45fee1d2b70eb366970bd
Author: Álvaro Herrera <alvherre@kurilemu.de>

Modified Files
--------------
src/backend/access/brin/brin_tuple.c    |  2 +-
src/backend/access/common/heaptuple.c   | 55 ++++++++++++++++++++++++++-------
src/backend/access/common/indextuple.c  |  4 +--
src/backend/access/heap/heaptoast.c     | 18 +++++++----
src/backend/access/spgist/spgutils.c    |  4 +--
src/backend/executor/execTuples.c       |  5 +++
src/backend/utils/adt/array_userfuncs.c |  3 +-
src/backend/utils/adt/expandedrecord.c  |  3 +-
src/backend/utils/adt/multirangetypes.c |  7 +++++
src/include/access/htup_details.h       |  4 ++-
src/include/access/tupmacs.h            | 30 ++++++++++++++++++
11 files changed, 110 insertions(+), 25 deletions(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* pgsql: Protect against miscalculation of tuple sizes via int32 overflow
@ 2026-11-09 14:21  Noah Misch <noah@leadboat.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Noah Misch @ 2026-11-09 14:21 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* pgsql: Protect against miscalculation of tuple sizes via int32 overflow
@ 2026-11-09 14:22  Noah Misch <noah@leadboat.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Noah Misch @ 2026-11-09 14:22 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/317b7bcab012778c9fdab1d87b5315aba5e37364
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            | 31 +++++++++++++++++
7 files changed, 113 insertions(+), 16 deletions(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2026-11-09 14:22 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-11-09 14:21 pgsql: Protect against miscalculation of tuple sizes via int32 overflow Noah Misch <noah@leadboat.com>
2026-11-09 14:21 pgsql: Protect against miscalculation of tuple sizes via int32 overflow Noah Misch <noah@leadboat.com>
2026-11-09 14:22 pgsql: Protect against miscalculation of tuple sizes via int32 overflow Noah Misch <noah@leadboat.com>

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