From: Nathan Bossart <nathan@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix various overflow hazards in date and timestamp functions.
Date: Mon, 09 Dec 2024 19:48:19 +0000
Message-ID: <E1tKjjv-001ur3-C4@gemulon.postgresql.org> (raw)
Fix various overflow hazards in date and timestamp functions.
This commit makes use of the overflow-aware routines in int.h to
fix a variety of reported overflow bugs in the date and timestamp
code. It seems unlikely that this fixes all such bugs in this
area, but since the problems seem limited to cases that are far
beyond any realistic usage, I'm not going to worry too much. Note
that for one bug, I've chosen to simply add a comment about the
overflow hazard because fixing it would require quite a bit of code
restructuring that doesn't seem worth the risk.
Since this is a bug fix, it could be back-patched, but given the
risk of conflicts with the new routines in int.h and the overall
risk/reward ratio of this patch, I've opted not to do so for now.
Fixes bug #18585 (except for the one case that's just commented).
Reported-by: Alexander Lakhin
Author: Matthew Kim, Nathan Bossart
Reviewed-by: Joseph Koshakow, Jian He
Discussion: https://postgr.es/m/31ad2cd1-db94-bdb3-f91a-65ffdb4bef95%40gmail.com
Discussion: https://postgr.es/m/18585-db646741dd649abd%40postgresql.org
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/0a27c3d0f733c132a4c5122e749a619d02937a8a
Modified Files
--------------
src/backend/utils/adt/date.c | 9 ++-
src/backend/utils/adt/formatting.c | 100 ++++++++++++++++++++++++++++++---
src/backend/utils/adt/timestamp.c | 4 ++
src/include/common/int.h | 48 ++++++++++++++++
src/test/regress/expected/date.out | 2 +
src/test/regress/expected/horology.out | 16 ++++++
src/test/regress/sql/date.sql | 1 +
src/test/regress/sql/horology.sql | 8 +++
8 files changed, 179 insertions(+), 9 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: nathan@postgresql.org, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Fix various overflow hazards in date and timestamp functions.
In-Reply-To: <E1tKjjv-001ur3-C4@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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