From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Avoid copying undefined data in _readA_Const().
Date: Sun, 19 Mar 2023 19:36:24 +0000
Message-ID: <E1pdypM-004MdY-Ai@gemulon.postgresql.org> (raw)
Avoid copying undefined data in _readA_Const().
nodeRead() will have created a Node struct that's only allocated big
enough for the specific node type, so copying sizeof(union ValUnion)
can be copying too much. This provokes valgrind complaints, and with
very bad luck could perhaps result in SIGSEGV.
While at it, tidy up _equalA_Const to avoid duplicate checks of isnull.
Per report from Alexander Lakhin. This code is new as of a6bc33019,
so no need to back-patch.
Discussion: https://postgr.es/m/4995256b-cc65-170e-0b22-60ad2cd535f1@gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/e060cd59fabda2a0b2a7e119a58887791d030942
Modified Files
--------------
src/backend/nodes/equalfuncs.c | 8 +++-----
src/backend/nodes/readfuncs.c | 25 ++++++++++++++++++++++++-
2 files changed, 27 insertions(+), 6 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 using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Avoid copying undefined data in _readA_Const().
In-Reply-To: <E1pdypM-004MdY-Ai@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