pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Avoid reference to nonexistent array element in ExecInitAgg().
Date: Mon, 02 Jan 2023 21:17:19 +0000
Message-ID: <E1pCSBK-001jTh-UG@gemulon.postgresql.org> (raw)

Avoid reference to nonexistent array element in ExecInitAgg().

When considering an empty grouping set, we fetched
phasedata->eqfunctions[-1].  Because the eqfunctions array is
palloc'd, that would always be an aset pointer in released versions,
and thus the code accidentally failed to malfunction (since it would
do nothing unless it found a null pointer).  Nonetheless this seems
like trouble waiting to happen, so add a check for length == 0.

It's depressing that our valgrind testing did not catch this.
Maybe we should reconsider the choice to not mark that word NOACCESS?

Richard Guo

Discussion: https://postgr.es/m/CAMbWs4-vZuuPOZsKOYnSAaPYGKhmacxhki+vpOKk0O7rymccXQ@mail.gmail.com

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/19adcaf00f7d8480f231bcfbb6b7a4401a531ce5

Modified Files
--------------
src/backend/executor/nodeAgg.c | 5 +++++
1 file changed, 5 insertions(+)



view thread (6+ messages)  latest in thread

Message-ID: <E1pCSBK-001jTh-UG@gemulon.postgresql.org>
Permalink:  ../E1pCSBK-001jTh-UG@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1pCSBK-001jTh-UG@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 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: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Avoid reference to nonexistent array element in ExecInitAgg().
  In-Reply-To: <E1pCSBK-001jTh-UG@gemulon.postgresql.org>
  References: <E1pCSBK-001jTh-UG@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