From: Tom Lane <tgl@sss.pgh.pa.us>
To: wurongxin@xmu.edu.cn
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16070: A double-free bug in interfaces/libpq/fe-secure-openssl.c
Date: Sun, 20 Oct 2019 10:17:11 -0400
Message-ID: <13213.1571581031@sss.pgh.pa.us> (raw)
In-Reply-To: <16070-ffac944519a43c3f@postgresql.org>
References: <16070-ffac944519a43c3f@postgresql.org>
PG Bug reporting form <noreply@postgresql.org> writes:
> In
> https://github.com/postgres/postgres/blob/REL_10_STABLE/src/interfaces/libpq/fe-secure-openssl.c,
> at Line 1206, it would call the function "ENGINE_finish" and free
> conn->engine. At Line 1207, it would call the function "ENGINE_free" and
> free conn->engine again. This would lead to a double free bug.
I don't really believe this; if there were a double-free problem here,
we'd surely have noticed it long since.
Taking a look at the OpenSSL source code, it looks like engine_free_util
decrements a reference count and doesn't actually delete anything until
that's gone to zero. So maybe the refcount is 2 at the beginning of
this sequence?
regards, tom lane
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: tgl@sss.pgh.pa.us, wurongxin@xmu.edu.cn
Subject: Re: BUG #16070: A double-free bug in interfaces/libpq/fe-secure-openssl.c
In-Reply-To: <13213.1571581031@sss.pgh.pa.us>
References: <16070-ffac944519a43c3f@postgresql.org> <13213.1571581031@sss.pgh.pa.us>
* 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