Re: SIGSEGV in PQreset(..)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: az(at)rpiva(dot)lv
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: SIGSEGV in PQreset(..)
Date: 2006-02-13 22:09:03
Message-ID: 5379.1139868543@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Arturs Zoldners <az(at)rpiva(dot)lv> writes:
> The following code raises SIGSEGV:

> PGconn* conn = PQconnectdb("x");
> ConnStatusType status = PQstatus(conn);
> //status == CONNECTION_BAD
> PQreset(conn);

PQreset assumes it's been passed a reasonably valid PGconn, which is not
the case if conninfo_parse couldn't make any sense of the connect
options string. We probably ought to add a state flag to indicate
whether the options have been set up successfully, and cause PQreset to
fail if not. (The alternative seems to be for PQreset to refuse to do
anything if the connection state is CONNECTION_BAD, but that looks like
it would destroy most of the usefulness of PQreset ...)

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Stephen Frost 2006-02-14 02:02:59 Re: BUG #2246: Bad malloc interactions: ecpg, openssl
Previous Message Tom Lane 2006-02-13 21:45:08 Re: BUG #2246: Bad malloc interactions: ecpg, openssl