From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: ecpg: fix some minor mishandling of bad input in preprocessor.
Date: Wed, 16 Oct 2024 16:25:09 +0000
Message-ID: <E1t16ph-0016wW-LA@gemulon.postgresql.org> (raw)
ecpg: fix some minor mishandling of bad input in preprocessor.
Avoid null-pointer crash when considering a cursor declaration
that's outside any C function (a case which is useless anyway).
Ensure a cursor for a prepared statement is marked as initially
not open. At worst, if we chanced to get not-already-zeroed memory
from malloc(), this oversight would result in failing to issue a
"cursor "foo" has been declared but not opened" warning that would
have been appropriate.
Avoid running off the end of the buffer when there are mismatched
square brackets following a variable name. This could lead to
SIGSEGV after reaching the end of memory.
Given the lack of field complaints, none of these seem to be worth
back-patching, but let's clean them up in HEAD.
Per valgrind testing by Alexander Lakhin.
Discussion: https://postgr.es/m/5f5bcecd-d7ec-b8c0-6c92-d1a7c6e0f639@gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/9b4bf5169064044ff082c61bf0783c4a65c08734
Modified Files
--------------
src/interfaces/ecpg/preproc/ecpg.header | 3 ++-
src/interfaces/ecpg/preproc/ecpg.trailer | 1 +
src/interfaces/ecpg/preproc/variable.c | 3 +++
3 files changed, 6 insertions(+), 1 deletion(-)
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: ecpg: fix some minor mishandling of bad input in preprocessor.
In-Reply-To: <E1t16ph-0016wW-LA@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