pgsql: Fix assign_record_type_typmod(). - Mailing list pgsql-committers

From Jeff Davis
Subject pgsql: Fix assign_record_type_typmod().
Date
Msg-id E1m2H1Z-0001v3-9T@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Fix assign_record_type_typmod().

If an error occurred in the wrong place, it was possible to leave an
unintialized entry in the hash table, leading to a crash. Fixed.

Also, be more careful about the order of operations so that an
allocation error doesn't leak memory in CacheMemoryContext or
unnecessarily advance NextRecordTypmod.

Backpatch through version 11. Earlier versions (prior to 35ea75632a5)
do not exhibit the problem, because an uninitialized hash entry
contains a valid empty list.

Author: Sait Talha Nisanci <Sait.Nisanci@microsoft.com>
Reviewed-by: Andres Freund
Discussion: https://postgr.es/m/HE1PR8303MB009069D476225B9A9E194B8891779@HE1PR8303MB0090.EURPRD83.prod.outlook.com
Backpatch-through: 11

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/5b1621d2fb736bcec58114faf035e6ad9bd64a1d

Modified Files
--------------
src/backend/utils/cache/typcache.c | 28 +++++++++++++++++++++++-----
1 file changed, 23 insertions(+), 5 deletions(-)


pgsql-committers by date:

Previous
From: Jeff Davis
Date:
Subject: pgsql: Fix assign_record_type_typmod().
Next
From: Jeff Davis
Date:
Subject: pgsql: Fix assign_record_type_typmod().