pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Munro <tmunro@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix exception safety bug in typcache.c.
Date: Wed, 13 Sep 2023 03:10:42 +0000
Message-ID: <E1qgGH3-003ZhF-LB@gemulon.postgresql.org> (raw)

Fix exception safety bug in typcache.c.

If an out-of-memory error was thrown at an unfortunate time,
ensure_record_cache_typmod_slot_exists() could leak memory and leave
behind a global state that produced an infinite loop on the next call.

Fix by merging RecordCacheArray and RecordIdentifierArray into a single
array.  With only one allocation or re-allocation, there is no
intermediate state.

Back-patch to all supported releases.

Reported-by: "James Pang (chaolpan)" <chaolpan@cisco.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/PH0PR11MB519113E738814BDDA702EDADD6EFA%40PH0PR11MB5191.namprd11.prod.outlook.com

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/6ae57f190e276f46bc2d0b616515bed4b4f664ce

Modified Files
--------------
src/backend/utils/cache/typcache.c | 52 +++++++++++++++++++-------------------
src/tools/pgindent/typedefs.list   |  1 +
2 files changed, 27 insertions(+), 26 deletions(-)



view thread (7+ messages)

Message-ID: <E1qgGH3-003ZhF-LB@gemulon.postgresql.org>
Permalink:  ../E1qgGH3-003ZhF-LB@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1qgGH3-003ZhF-LB@gemulon.postgresql.org

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tmunro@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Fix exception safety bug in typcache.c.
  In-Reply-To: <E1qgGH3-003ZhF-LB@gemulon.postgresql.org>

* 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