Re: BUG #18797: pointer te->defn not checked for NULL

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: dan-eli(at)mail(dot)ru
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18797: pointer te->defn not checked for NULL
Date: 2025-02-06 15:17:35
Message-ID: 1085622.1738855055@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> in function PGTYPEStimestamp_defmt_scan there is a usage of pgtypes_alloc().
> In other functions the result of pgtypes_alloc is being checked for NULL.

Thanks for the report! It looks like this was already dealt with
during the v17 cycle:

Author: Michael Paquier <michael(at)paquier(dot)xyz>
Branch: master Release: REL_17_BR [0a9118ccc] 2024-02-19 09:05:51 +0900

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

I tend to agree with Michael's conclusion that an error here is
improbable enough to not justify a back-patch.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2025-02-06 15:26:02 Re: BUG #18799: /src/interfaces/ecpg/pgtypeslib/timestamp.c possible NULL deref
Previous Message Sandeep Thakkar 2025-02-06 13:17:11 Re: BUG #18794: pgBouncer Windows installation error due to a simple sql bug???