1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-03 15:22:11 +03:00

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
This commit is contained in:
Thomas Munro
2023-09-13 14:32:24 +12:00
parent f7d25117ba
commit e2452c2a63
2 changed files with 27 additions and 26 deletions

View File

@@ -2125,6 +2125,7 @@ ReadExtraTocPtrType
ReadFunc
ReassignOwnedStmt
RecheckForeignScan_function
RecordCacheArrayEntry
RecordCacheEntry
RecordCompareData
RecordIOData