Re: SegFault in 7.0.3 libpq.so.2.1

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Heinz Ekker" <hekker(at)netway(dot)at>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: SegFault in 7.0.3 libpq.so.2.1
Date: 2001-01-19 15:40:54
Message-ID: 8497.979918854@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Heinz Ekker" <hekker(at)netway(dot)at> writes:
> In my setup, which is RedHat 7.0, libc-2.2, glibc 2.96 (yes, the bad one)
> and perl 5.6.0 with DBI-1.14 and DBD-Pg-0.95 libpq.so.2.1 segfaults due to
> a null pointer dereference in printfPQExpBuffer.

> (gdb) bt
> #0 _IO_vsnprintf (string=0x0, maxlen=255,
> format=0x401f5ce0 "PQsendQuery() -- There is no connection to the
> backend.\n
> ", args=0xbffff620) at vsnprintf.c:127
> #1 0x401f4c2f in printfPQExpBuffer () from /opt/postgres/lib/libpq.so.2.1
> #2 0x401f0307 in PQsendQuery () from /opt/postgres/lib/libpq.so.2.1
> #3 0x401f0dc9 in PQexec () from /opt/postgres/lib/libpq.so.2.1
> #4 0x401e455c in dbd_db_commit ()
> from /usr/lib/perl5/site_perl/5.6.0/i386-linux/auto/DBD/Pg/Pg.so
> #5 0x401e10c6 in XS_DBD__Pg__db_commit ()
> from /usr/lib/perl5/site_perl/5.6.0/i386-linux/auto/DBD/Pg/Pg.so
> #6 0x401d57f7 in XS_DBI_dispatch ()
> from /usr/lib/perl5/site_perl/5.6.0/i386-linux/auto/DBI/DBI.so
> #7 0x809ddae in Perl_pp_entersub ()
> #8 0x809865a in Perl_runops_standard ()
> #9 0x805bfbe in perl_run ()
> #10 0x805bd22 in perl_run ()
> #11 0x8059a11 in main ()

I am going to guess that the root problem is in the Perl code: I suspect
that PQexec is being handed a bogus PGconn pointer --- possibly a
pointer to a connection object that had already been closed. Can't
prove it on this amount of data, however.

It does look like libpq will behave ungracefully in that case :-(.
Will fix that part.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2001-01-19 16:14:38 Re: PlPerl.c patch
Previous Message Michael Meskes 2001-01-19 15:34:07 Re: Re: Changes to include files