Thread: BUG #18799: /src/interfaces/ecpg/pgtypeslib/timestamp.c possible NULL deref

BUG #18799: /src/interfaces/ecpg/pgtypeslib/timestamp.c possible NULL deref

From
PG Bug reporting form
Date:
The following bug has been logged on the website:

Bug reference:      18799
Logged by:          Daniel Elishakov
Email address:      dan-eli@mail.ru
PostgreSQL version: 16.6
Operating system:   ubuntu 20.04
Description:

Pointer, returned from function 'localtime' at timestamp.c:141, may be NULL
and is dereferenced at timestamp.c:142.In practice this shouldn't be a
problem, but for strictness it's better to fix this. See
'src/bin/initdb/findtimezone.c' for example of proper handling.


PG Bug reporting form <noreply@postgresql.org> writes:
> Pointer, returned from function 'localtime' at timestamp.c:141, may be NULL
> and is dereferenced at timestamp.c:142.In practice this shouldn't be a
> problem, but for strictness it's better to fix this. See
> 'src/bin/initdb/findtimezone.c' for example of proper handling.

I do not see an issue here.  The only defined failure condition for
localtime() is timestamp-out-of-range, and we already checked the
range.

            regards, tom lane