public inbox for [email protected]  
help / color / mirror / Atom feed
From: SATYANARAYANA NARLAPURAM <[email protected]>
To: Andrew Dunstan <[email protected]>
Cc: Nishant Sharma <[email protected]>
Cc: Shruthi Gowda <[email protected]>
Cc: Mahendra Singh Thalor <[email protected]>
Cc: Fujii Masao <[email protected]>
Cc: Tom Lane <[email protected]>
Cc: PostgreSQL Development <[email protected]>
Subject: Re: [BUG] CRASH: ECPGprepared_statement() and ECPGdeallocate_all() when connection is NULL
Date: Sat, 23 May 2026 11:59:44 -0700
Message-ID: <CAHg+QDe=UwWiKo6Yqc5=sUdhG=jm7jWd42yM8iGmadbnU0YNEw@mail.gmail.com> (raw)
In-Reply-To: <CAD5tBcL7rMgeykb2ZRF3t00SaWzOhtVME-fDqvspH88d+rosFw@mail.gmail.com>
References: <CAASxf_P1F75Ck+0qyb10auT+BORupOM4yigXBnm7aWRNx1LYcA@mail.gmail.com>
	<[email protected]>
	<CAASxf_P5f=Frf8S7rN9BzphtCLoeN9vFuh-V7ukotOQZU54g+w@mail.gmail.com>
	<CAHGQGwHAPXexiGaHMkDDRF7cPBr_3fgCNdT4n2+1UjaEU++BAQ@mail.gmail.com>
	<CAASxf_OGWD7PA5TMEh2MdF2YxN8V3ByLhnFJ=uw0hKr33sgqAw@mail.gmail.com>
	<CAKYtNAqjJbzV+ZJDqA-s0fHSLen6msc=A0SfrTS1ub1KKH9haQ@mail.gmail.com>
	<CADrsxdbb2fn1LACQShrQT0bNqSCQ3hSzEojb2tODhD0PmewDiA@mail.gmail.com>
	<CAASxf_OdsJRi17EZ_ZMyQgOwUzn357YyMqJ2Z2qiExPaLRW_Lg@mail.gmail.com>
	<CADrsxdbPw1ZYcuqH1-DTNhAvRN=tRTTY+_dFy8wU2g4DQb67Bg@mail.gmail.com>
	<CAASxf_PtXCsmu5oCvZH4BmLdojG+0XJUH8foHFZv+2vmsSbNwA@mail.gmail.com>
	<CADrsxdZMOc6qkoVcyp67+Ez8cesey3iDVaVm617oSpiDdf=5xQ@mail.gmail.com>
	<CAASxf_OkeXLZy6r7f05-LjwxgHEXJymQgifU27CAvWEYfY7uVA@mail.gmail.com>
	<CADrsxdZhGHj96ZYy9GR6U9yLtTshfOU-3DFd0aoz70C5S3Np5g@mail.gmail.com>
	<CAASxf_O+CN9Pw+XSHCbfHE2DwS1BObAwFZnnQyT+7062ozYGQw@mail.gmail.com>
	<CADrsxdb_7nCwjfoFJ3p3QvOyQtZUkDVm0aqX73bWd+27tOTO7w@mail.gmail.com>
	<CAD5tBcL7rMgeykb2ZRF3t00SaWzOhtVME-fDqvspH88d+rosFw@mail.gmail.com>

Hi

On Fri, May 1, 2026 at 12:21 PM Andrew Dunstan <[email protected]> wrote:

>
>
> On Wed, Apr 22, 2026 at 12:27 AM Nishant Sharma <
> [email protected]> wrote:
>
>> Thanks Shruthi!
>>
>> v5 code, v4_test and v4_test_15 patches look good to me.
>>
>> I checked ECPG regression on master, REL_18, REL_17, REL_16, REL_15,
>> REL_14 using both make and meson.
>>
>> I have finished my review work on the patches. Thank you!
>>
>>
>>
>>
> Thanks, everybody, pushed (as combined patches)
>

Looks like this committed a case, attached a patch to fix this.

Thanks,
Satya


Attachments:

  [application/octet-stream] 0006-ecpg-fix-null-deref-in-ecpg_auto_prepare.patch (667B, 3-0006-ecpg-fix-null-deref-in-ecpg_auto_prepare.patch)
  download | inline diff:
diff --git a/src/interfaces/ecpg/ecpglib/prepare.c b/src/interfaces/ecpg/ecpglib/prepare.c
index 3874a64ae8e..7a9036bcfc0 100644
--- a/src/interfaces/ecpg/ecpglib/prepare.c
+++ b/src/interfaces/ecpg/ecpglib/prepare.c
@@ -620,6 +620,11 @@ ecpg_auto_prepare(int lineno, const char *connection_name, const int compat, cha
 			return false;
 
 		con = ecpg_get_connection(connection_name);
+		if (!ecpg_init(con, connection_name, lineno))
+		{
+			ecpg_free(*name);
+			return false;
+		}
 		prep = ecpg_find_prepared_statement(stmtID, con, NULL);
 		/* This prepared name doesn't exist on this connection. */
 		if (!prep && !prepare_common(lineno, con, stmtID, query))


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: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: [BUG] CRASH: ECPGprepared_statement() and ECPGdeallocate_all() when connection is NULL
  In-Reply-To: <CAHg+QDe=UwWiKo6Yqc5=sUdhG=jm7jWd42yM8iGmadbnU0YNEw@mail.gmail.com>

* 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