Thread: [BUGS] BUG #14801: ECPG core dump

[BUGS] BUG #14801: ECPG core dump

From
davidr@openscg.com
Date:
The following bug has been logged on the website:

Bug reference:      14801
Logged by:          David Rader
Email address:      davidr@openscg.com
PostgreSQL version: 9.6.4
Operating system:   CentOS 7
Description:

Using a int* variable as a where-clause parameter in a declare cursor
construct causes ECPG to Abort (core dump). Using an int variable works
correctly (as expected), and using a pointer type in where clause in a
simple select into works.

$ /usr/pgsql-9.6/bin/ecpg bug1.pgc
Aborted (core dumped)
$ cat bug1.pgc
int main(  )

{
EXEC SQL BEGIN DECLARE SECTION;int iparm = 5, iparm2;int *pparm = &iparm;int *outparm = &iparm2;EXEC SQL END DECLARE
SECTION;
// this runs through ECPG with no warning/*EXEC SQL select 2 into :outparm from foo where foo.bar = :pparm;*/// this
causesAbort (core dumped)EXEC SQL DECLARE buggy CURSOR FORselect 2 from foo where foo.bar = :pparm;
 

   return( 0 );

}



--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Re: [BUGS] BUG #14801: ECPG core dump

From
Michael Meskes
Date:
On Wed, Sep 06, 2017 at 04:12:12PM +0000, davidr@openscg.com wrote:
> Using a int* variable as a where-clause parameter in a declare cursor
> construct causes ECPG to Abort (core dump). Using an int variable works
> correctly (as expected), and using a pointer type in where clause in a
> simple select into works.

Could you please try the attached little patch to see if it works with your
real life case? It does work with the test case. I will also git push as soon
as I'm back on the ground.

Thanks.

Michael
-- 
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Meskes at (Debian|Postgresql) dot Org
Jabber: michael at xmpp dot meskes dot org
VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Attachment