Re: BUG #16070: A double-free bug in interfaces/libpq/fe-secure-openssl.c - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #16070: A double-free bug in interfaces/libpq/fe-secure-openssl.c
Date
Msg-id 13213.1571581031@sss.pgh.pa.us
Whole thread Raw
In response to BUG #16070: A double-free bug in interfaces/libpq/fe-secure-openssl.c  (PG Bug reporting form <noreply@postgresql.org>)
Responses Re: BUG #16070: A double-free bug ininterfaces/libpq/fe-secure-openssl.c
List pgsql-bugs
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



pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #16070: A double-free bug in interfaces/libpq/fe-secure-openssl.c
Next
From: Tom Lane
Date:
Subject: Re: Re: BUG #16068: Collate of 'Norwegian Bokmål' is problematic