pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Avoid null pointer crash after pg_localtime()/pg_gmtime() failur
6+ messages / 1 participants
[nested] [flat]

* pgsql: Avoid null pointer crash after pg_localtime()/pg_gmtime() failur
@ 2026-11-25 02:20  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2026-11-25 02:20 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Avoid null pointer crash after pg_localtime()/pg_gmtime() failure.

localtime(3) and gmtime(3) are specified to return NULL on failure,
and our versions do that too, but most of our call sites did not
guard against such a result.  Make them more wary.

Many of these call sites pass the result straight to pg_strftime(),
so the path of least resistance is to harden that function rather
than touch all its callers.  I made it return an empty string, as
it already does for other failure cases.  In other places the
fallback behavior can be to use UTC timezone.

The possible causes of a NULL result seem to be (a) malloc() failure
or (b) integer overflow in time calculations.  Anthropic found a
case where an integer overflow could be triggered with a contrived
POSIX timezone setting; that seems to be a bug in the 2026b tzcode
release we're using in master, which has already been repaired
upstream.  Since it won't occur with sane timezone settings, I'm
not going to worry about fixing it before our next tzcode merge.
We should guard against these failure returns in any case.

Reported to security@ by Anthropic, but they described it as a
non-security bug, which matches our policy: a plain NULL-pointer
dereference without any worse consequences is not security material.

Reported-by: Anthropic OSS program
Author: Tom Lane <tgl@sss.pgh.pa.us>
Backpatch-through: 15

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/93e2b79f5f66ee305338bd956e70a96c9d114ac7

Modified Files
--------------
src/backend/postmaster/syslogger.c |  7 +++--
src/backend/utils/adt/timestamp.c  | 52 ++++++++++++++++++++------------------
src/timezone/strftime.c            | 11 ++++++++
3 files changed, 43 insertions(+), 27 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Avoid null pointer crash after pg_localtime()/pg_gmtime() failur
@ 2026-11-25 02:20  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2026-11-25 02:20 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Avoid null pointer crash after pg_localtime()/pg_gmtime() failure.

localtime(3) and gmtime(3) are specified to return NULL on failure,
and our versions do that too, but most of our call sites did not
guard against such a result.  Make them more wary.

Many of these call sites pass the result straight to pg_strftime(),
so the path of least resistance is to harden that function rather
than touch all its callers.  I made it return an empty string, as
it already does for other failure cases.  In other places the
fallback behavior can be to use UTC timezone.

The possible causes of a NULL result seem to be (a) malloc() failure
or (b) integer overflow in time calculations.  Anthropic found a
case where an integer overflow could be triggered with a contrived
POSIX timezone setting; that seems to be a bug in the 2026b tzcode
release we're using in master, which has already been repaired
upstream.  Since it won't occur with sane timezone settings, I'm
not going to worry about fixing it before our next tzcode merge.
We should guard against these failure returns in any case.

Reported to security@ by Anthropic, but they described it as a
non-security bug, which matches our policy: a plain NULL-pointer
dereference without any worse consequences is not security material.

Reported-by: Anthropic OSS program
Author: Tom Lane <tgl@sss.pgh.pa.us>
Backpatch-through: 15

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/27da34042b82747387f6b0c2e0cf3dcea976ced6

Modified Files
--------------
src/backend/postmaster/syslogger.c |  7 +++--
src/backend/utils/adt/timestamp.c  | 52 ++++++++++++++++++++------------------
src/timezone/strftime.c            | 11 ++++++++
3 files changed, 43 insertions(+), 27 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Avoid null pointer crash after pg_localtime()/pg_gmtime() failur
@ 2026-11-25 02:20  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2026-11-25 02:20 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Avoid null pointer crash after pg_localtime()/pg_gmtime() failure.

localtime(3) and gmtime(3) are specified to return NULL on failure,
and our versions do that too, but most of our call sites did not
guard against such a result.  Make them more wary.

Many of these call sites pass the result straight to pg_strftime(),
so the path of least resistance is to harden that function rather
than touch all its callers.  I made it return an empty string, as
it already does for other failure cases.  In other places the
fallback behavior can be to use UTC timezone.

The possible causes of a NULL result seem to be (a) malloc() failure
or (b) integer overflow in time calculations.  Anthropic found a
case where an integer overflow could be triggered with a contrived
POSIX timezone setting; that seems to be a bug in the 2026b tzcode
release we're using in master, which has already been repaired
upstream.  Since it won't occur with sane timezone settings, I'm
not going to worry about fixing it before our next tzcode merge.
We should guard against these failure returns in any case.

Reported to security@ by Anthropic, but they described it as a
non-security bug, which matches our policy: a plain NULL-pointer
dereference without any worse consequences is not security material.

Reported-by: Anthropic OSS program
Author: Tom Lane <tgl@sss.pgh.pa.us>
Backpatch-through: 15

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/d204569be46ca9f9f687bf22d51fe6bf21cff769

Modified Files
--------------
src/backend/postmaster/syslogger.c |  7 +++--
src/backend/utils/adt/timestamp.c  | 52 ++++++++++++++++++++------------------
src/timezone/strftime.c            | 11 ++++++++
3 files changed, 43 insertions(+), 27 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Avoid null pointer crash after pg_localtime()/pg_gmtime() failur
@ 2026-11-25 02:20  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2026-11-25 02:20 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Avoid null pointer crash after pg_localtime()/pg_gmtime() failure.

localtime(3) and gmtime(3) are specified to return NULL on failure,
and our versions do that too, but most of our call sites did not
guard against such a result.  Make them more wary.

Many of these call sites pass the result straight to pg_strftime(),
so the path of least resistance is to harden that function rather
than touch all its callers.  I made it return an empty string, as
it already does for other failure cases.  In other places the
fallback behavior can be to use UTC timezone.

The possible causes of a NULL result seem to be (a) malloc() failure
or (b) integer overflow in time calculations.  Anthropic found a
case where an integer overflow could be triggered with a contrived
POSIX timezone setting; that seems to be a bug in the 2026b tzcode
release we're using in master, which has already been repaired
upstream.  Since it won't occur with sane timezone settings, I'm
not going to worry about fixing it before our next tzcode merge.
We should guard against these failure returns in any case.

Reported to security@ by Anthropic, but they described it as a
non-security bug, which matches our policy: a plain NULL-pointer
dereference without any worse consequences is not security material.

Reported-by: Anthropic OSS program
Author: Tom Lane <tgl@sss.pgh.pa.us>
Backpatch-through: 15

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/2d3c50c1399742a2e26c8899843ac0c0edc9ba8a

Modified Files
--------------
src/backend/postmaster/syslogger.c |  7 +++--
src/backend/utils/adt/timestamp.c  | 52 ++++++++++++++++++++------------------
src/timezone/strftime.c            | 11 ++++++++
3 files changed, 43 insertions(+), 27 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Avoid null pointer crash after pg_localtime()/pg_gmtime() failur
@ 2026-11-25 02:20  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2026-11-25 02:20 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Avoid null pointer crash after pg_localtime()/pg_gmtime() failure.

localtime(3) and gmtime(3) are specified to return NULL on failure,
and our versions do that too, but most of our call sites did not
guard against such a result.  Make them more wary.

Many of these call sites pass the result straight to pg_strftime(),
so the path of least resistance is to harden that function rather
than touch all its callers.  I made it return an empty string, as
it already does for other failure cases.  In other places the
fallback behavior can be to use UTC timezone.

The possible causes of a NULL result seem to be (a) malloc() failure
or (b) integer overflow in time calculations.  Anthropic found a
case where an integer overflow could be triggered with a contrived
POSIX timezone setting; that seems to be a bug in the 2026b tzcode
release we're using in master, which has already been repaired
upstream.  Since it won't occur with sane timezone settings, I'm
not going to worry about fixing it before our next tzcode merge.
We should guard against these failure returns in any case.

Reported to security@ by Anthropic, but they described it as a
non-security bug, which matches our policy: a plain NULL-pointer
dereference without any worse consequences is not security material.

Reported-by: Anthropic OSS program
Author: Tom Lane <tgl@sss.pgh.pa.us>
Backpatch-through: 15

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/56b12b1bcee8aee287979fcf26f8547c6156aebb

Modified Files
--------------
src/backend/postmaster/syslogger.c |  7 +++--
src/backend/utils/adt/timestamp.c  | 52 ++++++++++++++++++++------------------
src/timezone/strftime.c            | 11 ++++++++
3 files changed, 43 insertions(+), 27 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Avoid null pointer crash after pg_localtime()/pg_gmtime() failur
@ 2026-11-25 02:20  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2026-11-25 02:20 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Avoid null pointer crash after pg_localtime()/pg_gmtime() failure.

localtime(3) and gmtime(3) are specified to return NULL on failure,
and our versions do that too, but most of our call sites did not
guard against such a result.  Make them more wary.

Many of these call sites pass the result straight to pg_strftime(),
so the path of least resistance is to harden that function rather
than touch all its callers.  I made it return an empty string, as
it already does for other failure cases.  In other places the
fallback behavior can be to use UTC timezone.

The possible causes of a NULL result seem to be (a) malloc() failure
or (b) integer overflow in time calculations.  Anthropic found a
case where an integer overflow could be triggered with a contrived
POSIX timezone setting; that seems to be a bug in the 2026b tzcode
release we're using in master, which has already been repaired
upstream.  Since it won't occur with sane timezone settings, I'm
not going to worry about fixing it before our next tzcode merge.
We should guard against these failure returns in any case.

Reported to security@ by Anthropic, but they described it as a
non-security bug, which matches our policy: a plain NULL-pointer
dereference without any worse consequences is not security material.

Reported-by: Anthropic OSS program
Author: Tom Lane <tgl@sss.pgh.pa.us>
Backpatch-through: 15

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/e2b5126f8f6d90870be01621378c5d84b93fd948

Modified Files
--------------
src/backend/postmaster/syslogger.c |  7 +++--
src/backend/utils/adt/timestamp.c  | 52 ++++++++++++++++++++------------------
src/timezone/strftime.c            | 11 ++++++++
3 files changed, 43 insertions(+), 27 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2026-11-25 02:20 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-11-25 02:20 pgsql: Avoid null pointer crash after pg_localtime()/pg_gmtime() failur Tom Lane <tgl@sss.pgh.pa.us>
2026-11-25 02:20 pgsql: Avoid null pointer crash after pg_localtime()/pg_gmtime() failur Tom Lane <tgl@sss.pgh.pa.us>
2026-11-25 02:20 pgsql: Avoid null pointer crash after pg_localtime()/pg_gmtime() failur Tom Lane <tgl@sss.pgh.pa.us>
2026-11-25 02:20 pgsql: Avoid null pointer crash after pg_localtime()/pg_gmtime() failur Tom Lane <tgl@sss.pgh.pa.us>
2026-11-25 02:20 pgsql: Avoid null pointer crash after pg_localtime()/pg_gmtime() failur Tom Lane <tgl@sss.pgh.pa.us>
2026-11-25 02:20 pgsql: Avoid null pointer crash after pg_localtime()/pg_gmtime() failur 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