pgsql: Fix assign_record_type_typmod().

From: Jeff Davis <jdavis(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix assign_record_type_typmod().
Date: 2021-07-10 17:44:03
Message-ID: E1m2H1H-0001sc-UO@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)Nisanci(at)microsoft(dot)com>
Reviewed-by: Andres Freund
Discussion: https://postgr.es/m/HE1PR8303MB009069D476225B9A9E194B8891779@HE1PR8303MB0090.EURPRD83.prod.outlook.com
Backpatch-through: 11

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/dd0e37cc1598050ec38fa289908487d4f5c96dca

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

Browse pgsql-committers by date

  From Date Subject
Next Message Jeff Davis 2021-07-10 17:44:10 pgsql: Fix assign_record_type_typmod().
Previous Message Tom Lane 2021-07-10 17:30:42 Re: pgsql: Fix numeric_mul() overflow due to too many digits after decimal