public inbox for [email protected]  
help / color / mirror / Atom feed
From: Tom Lane <[email protected]>
To: [email protected]
Subject: pgsql: Catch overflow when rounding intervals in AdjustIntervalForTypmo
Date: Tue, 13 Feb 2024 20:58:47 +0000
Message-ID: <[email protected]> (raw)

Catch overflow when rounding intervals in AdjustIntervalForTypmod.

Previously, an interval microseconds field close to INT64_MAX or
INT64_MIN could overflow, producing a result with not even the
correct sign, while being rounded to match a precision specification.

This seems worth fixing, but not worth back-patching, in part
because the ereturn() notation doesn't exist very far back.

Report and patch by Joseph Koshakow (some cosmetic mods by me)

Discussion: https://postgr.es/m/CAAvxfHfpuLgqJYzkUcher466Z1LpmE+5Sm+zc8L6zKCOQ+6TDQ@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/5ebc9c90173f32cffe373a80835f157b9ebfa3bd

Modified Files
--------------
src/backend/utils/adt/timestamp.c      | 22 ++++++++++++++--------
src/test/regress/expected/interval.out |  8 ++++++++
src/test/regress/sql/interval.sql      |  2 ++
3 files changed, 24 insertions(+), 8 deletions(-)



reply

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: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: pgsql: Catch overflow when rounding intervals in AdjustIntervalForTypmo
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox