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: Fix integer overflow in array_agg(), when the array grows too la
Date: Mon, 11 May 2026 12:19:41 +0000
Message-ID: <E1wMPbp-0002gH-0U@gemulon.postgresql.org> (raw)

Fix integer overflow in array_agg(), when the array grows too large

If you accumulate many arrays full of NULLs, you could overflow
'nitems', before reaching the MaxAllocSize limit on the allocations.
Add an explicit check that the number of items doesn't grow too large.
With more than MaxArraySize items, getting the final result with
makeArrayResultArr() would fail anyway, so better to error out early.

Reported-by: Xint Code
Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Backpatch-through: 14
Security: CVE-2026-6473

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/8e81995de30c5a1834d7dae56a6396067d491975
Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>

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



view thread (6+ messages)

Message-ID: <E1wMPbp-0002gH-0U@gemulon.postgresql.org>
Permalink:  ../E1wMPbp-0002gH-0U@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1wMPbp-0002gH-0U@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: Fix integer overflow in array_agg(), when the array grows too la
  In-Reply-To: <E1wMPbp-0002gH-0U@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