pgsql: ecpg: Fix error handling on OOMs when parsing timestamps

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: ecpg: Fix error handling on OOMs when parsing timestamps
Date: 2024-02-19 00:12:51
Message-ID: E1rbrH9-006vZp-IS@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

ecpg: Fix error handling on OOMs when parsing timestamps

pgtypes_alloc() can return NULL when failing an allocation, which is
something that PGTYPEStimestamp_defmt_asc() has forgotten about when
translating a timestamp for 'D', 'r', 'R' and 'T' as these require a
temporary allocation.

This is unlikely going to be a problem in practice, so no backpatch is
done.

Author: Oleg Tselebrovskiy
Discussion: https://postgr.es/m/bf47888585149f83b276861a1662f7e4@postgrespro.ru

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/0a9118ccc0eb2e6a31201b2443a2eb1078e34894

Modified Files
--------------
src/interfaces/ecpg/pgtypeslib/dt_common.c | 8 ++++++++
1 file changed, 8 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2024-02-19 02:39:20 pgsql: ecpg: Fix zero-termination of string generated by intoasc()
Previous Message Alexander Korotkov 2024-02-16 22:22:38 pgsql: Remove remaining references to timeouts-long