pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #18797: pointer te->defn not checked for NULL
2+ messages / 2 participants
[nested] [flat]
* BUG #18797: pointer te->defn not checked for NULL
@ 2025-02-06 11:28 PG Bug reporting form <noreply@postgresql.org>
0 siblings, 1 reply; 2+ messages in thread
From: PG Bug reporting form @ 2025-02-06 11:28 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org; +Cc: dan-eli@mail.ru
The following bug has been logged on the website:
Bug reference: 18797
Logged by: Daniel Elishakov
Email address: dan-eli@mail.ru
PostgreSQL version: 16.6
Operating system: ubuntu 20.04
Description:
src/interfaces/ecpg/pgtypeslib/dt_common.c:2662
src/interfaces/ecpg/pgtypeslib/dt_common.c:2787
src/interfaces/ecpg/pgtypeslib/dt_common.c:2795
src/interfaces/ecpg/pgtypeslib/dt_common.c:2840
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.
For example, in /src/interfaces/ecpg/pgtypeslib/numeric.c. I think in
PGTYPEStimestamp_defmt_scan it is also worth checking for NULL before
dereferencing in strcpy, because PGTYPEStimestamp_defmt_scan is being called
recursively and if there won't be any available memory to allocate, it can
be a real problem in terms of data consistency.
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: BUG #18797: pointer te->defn not checked for NULL
@ 2025-02-06 15:17 Tom Lane <tgl@sss.pgh.pa.us>
parent: PG Bug reporting form <noreply@postgresql.org>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2025-02-06 15:17 UTC (permalink / raw)
To: dan-eli@mail.ru; +Cc: pgsql-bugs@lists.postgresql.org
PG Bug reporting form <noreply@postgresql.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@paquier.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
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2025-02-06 15:17 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-02-06 11:28 BUG #18797: pointer te->defn not checked for NULL PG Bug reporting form <noreply@postgresql.org>
2025-02-06 15:17 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox