Re: SIGSEGV in PQreset(..) - Mailing list pgsql-bugs

From Tom Lane
Subject Re: SIGSEGV in PQreset(..)
Date
Msg-id 5379.1139868543@sss.pgh.pa.us
Whole thread Raw
In response to SIGSEGV in PQreset(..)  (Arturs Zoldners <az@rpiva.lv>)
List pgsql-bugs
Arturs Zoldners <az@rpiva.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

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #2246: Bad malloc interactions: ecpg, openssl
Next
From: "Evgeny Gridasov"
Date:
Subject: BUG #2257: Can' stop server while autovacuum is running