pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ranier VF <ranier_gyn@hotmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-bugs@postgresql.org <pgsql-bugs@postgresql.org>
Subject: Re: Use after free? in fe-connect.c:closePGconn
Date: Thu, 16 Jun 2016 16:26:48 +0000
Message-ID: <BLU183-W9C732F0EE44D74D3B634AE3560@phx.gbl> (raw)
In-Reply-To: <15516.1466031953@sss.pgh.pa.us>
References: <BLU183-W36C8721B5C151BC8DEFAA7E3550@phx.gbl>
	<15516.1466031953@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Hi Tom,

> All the callers do, so I don't entirely see your point.
Well, I still confuse...

> The stack traces you show look to me like the fault is probably in
> the caller, ie, calling PQfinish twice on the same "conn".
patch from dbd_pgsql_close function:
275       if (dbd->conn != NULL) {
276          #if defined(DEBUG) && !defined(_WIN32)
277          PQuntrace(dbd->conn);
278          #endif
279          PQfinish(dbd->conn);
280          dbd->conn = NULL;
281       }
282       FREE(dbd);
283       dbd = NULL;

IHMO, the caller of PQfinish can´t call twice.

Best regards,

Ranier

> From: tgl@sss.pgh.pa.us
> To: ranier_gyn@hotmail.com
> CC: pgsql-bugs@postgresql.org
> Subject: Re: [BUGS] Use after free? in fe-connect.c:closePGconn
> Date: Wed, 15 Jun 2016 19:05:53 -0400
> 
> Ranier VF <ranier_gyn@hotmail.com> writes:
> > In  [d:\pginstaller.auto\postgres.windows\src\interfaces\libpq\fe-connect.c,
> > closePGconn(PGconn *conn):
> > Does not check if conn is NULL.
> 
> All the callers do, so I don't entirely see your point.
> 
> The stack traces you show look to me like the fault is probably in
> the caller, ie, calling PQfinish twice on the same "conn".
> 
> 			regards, tom lane
 
	
      
		Livre de vírus. www.avast.com. 		
	

 		 	   		  =

view thread (3+ messages)

Message-ID: <BLU183-W9C732F0EE44D74D3B634AE3560@phx.gbl>
Permalink:  ../BLU183-W9C732F0EE44D74D3B634AE3560@phx.gbl/
Also on:    postgresql.org/message-id/BLU183-W9C732F0EE44D74D3B634AE3560@phx.gbl

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: ranier_gyn@hotmail.com, tgl@sss.pgh.pa.us
  Subject: Re: Use after free? in fe-connect.c:closePGconn
  In-Reply-To: <BLU183-W9C732F0EE44D74D3B634AE3560@phx.gbl>
  References: <BLU183-W36C8721B5C151BC8DEFAA7E3550@phx.gbl> <15516.1466031953@sss.pgh.pa.us> <BLU183-W9C732F0EE44D74D3B634AE3560@phx.gbl>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox