pgsql: pgcrypto: avoid recursive ResourceOwnerForget().

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: pgcrypto: avoid recursive ResourceOwnerForget().
Date: 2026-06-22 16:59:24
Message-ID: E1wbhzX-001QS6-2n@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

pgcrypto: avoid recursive ResourceOwnerForget().

Raising an error within a function using an OSSLCipher object led
to a complaint from ResourceOwnerForget and then a double-free crash,
because ResOwnerReleaseOSSLCipher forgot to unhook the OSSLCipher
object from its owner. (The sibling logic for OSSLDigest objects got
this right, as did every other ReleaseResource function AFAICS.)

Oversight in cd694f60d.

Bug: #19527
Reported-by: Yuelin Wang <3020001251(at)tju(dot)edu(dot)cn>
Author: Yuelin Wang <3020001251(at)tju(dot)edu(dot)cn>
Reviewed-by: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Discussion: https://postgr.es/m/19527-6e7686960c6dce78@postgresql.org
Backpatch-through: 17

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/020426268ff6acaa140780336eb1c50b034cb893

Modified Files
--------------
contrib/pgcrypto/openssl.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2026-06-22 22:03:33 pgsql: Fix unsafe order of operations in ResourceOwnerReleaseAll().
Previous Message Richard Guo 2026-06-22 01:44:13 pgsql: Strip removed-relation references from PlaceHolderVars at join r