pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dean Rasheed <dean.a.rasheed@gmail.com>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Guard against overflow in make_interval().
Date: Sun, 29 Oct 2023 15:54:14 +0000
Message-ID: <E1qx87C-002yRD-CA@gemulon.postgresql.org> (raw)

Guard against overflow in make_interval().

The original code did very little to guard against integer or floating
point overflow when computing the interval's fields.  Detect any such
overflows and error out, rather than silently returning bogus results.

Joseph Koshakow, reviewed by Ashutosh Bapat and me.

Discussion: https://postgr.es/m/CAAvxfHcm1TPwH_zaGWuFoL8pZBestbRZTU6Z%3D-RvAdSXTPbKfg%40mail.gmail.com

Branch
------
master

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

Modified Files
--------------
src/backend/utils/adt/timestamp.c      | 39 ++++++++++++++++++++++++----------
src/include/datatype/timestamp.h       |  1 +
src/test/regress/expected/interval.out | 27 +++++++++++++++++++++++
src/test/regress/sql/interval.sql      | 15 +++++++++++++
4 files changed, 71 insertions(+), 11 deletions(-)



Message-ID: <E1qx87C-002yRD-CA@gemulon.postgresql.org>
Permalink:  ../E1qx87C-002yRD-CA@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1qx87C-002yRD-CA@gemulon.postgresql.org

 · 

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: pgsql-committers@postgresql.org
  Cc: dean.a.rasheed@gmail.com, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Guard against overflow in make_interval().
  In-Reply-To: <E1qx87C-002yRD-CA@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