From: | Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Avoid integer overflow hazard in interval_time(). |
Date: | 2023-11-09 12:11:32 |
Message-ID: | E1r13si-004eQn-Cr@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Avoid integer overflow hazard in interval_time().
When casting an interval to a time, the original code suffered from
64-bit integer overflow for inputs with a sufficiently large negative
"time" field, leading to bogus results.
Fix by rewriting the algorithm in a simpler form, that more obviously
cannot overflow. While at it, improve the test coverage to include
negative interval inputs.
Discussion: https://postgr.es/m/CAEZATCXoUKHkcuq4q63hkiPsKZJd0kZWzgKtU%2BNT0aU4wbf_Pw%40mail.gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/3850d4dec1d91c4fdce274f42986840444d5593e
Modified Files
--------------
src/backend/utils/adt/date.c | 15 +++------------
src/test/regress/expected/horology.out | 12 ++++++++++++
src/test/regress/sql/horology.sql | 2 ++
3 files changed, 17 insertions(+), 12 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Alexander Korotkov | 2023-11-09 12:25:31 | pgsql: Fix the way SJE removes references from PHVs |
Previous Message | Dean Rasheed | 2023-11-09 11:30:18 | pgsql: Fix AFTER ROW trigger execution in MERGE cross-partition update. |