pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Detect more overflows in timestamp[tz]_pl_interval.
Date: Sun, 28 Apr 2024 17:42:28 +0000
Message-ID: <E1s18Xj-000UbQ-BN@gemulon.postgresql.org> (raw)

Detect more overflows in timestamp[tz]_pl_interval.

In commit 25cd2d640 I (tgl) opined that "The additions of the months
and microseconds fields could also overflow, of course.  However,
I believe we need no additional checks there; the existing range
checks should catch such cases".  This is demonstrably wrong however
for the microseconds field, and given that discovery it seems prudent
to be paranoid about the months addition as well.

Report and patch by Joseph Koshakow.  As before, back-patch to all
supported branches.  (However, the test case doesn't work before
v15 because we didn't allow wider-than-int32 numbers in interval
literals.  A variant test could probably be built that fits within
that restriction, but it didn't seem worth the trouble.)

Discussion: https://postgr.es/m/CAAvxfHf77sRHKoEzUw9_cMYSpbpNS2C+J_+8Dq4+0oi8iKopeA@mail.gmail.com

Branch
------
REL_15_STABLE

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

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



view thread (7+ messages)  latest in thread

Message-ID: <E1s18Xj-000UbQ-BN@gemulon.postgresql.org>
Permalink:  ../E1s18Xj-000UbQ-BN@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1s18Xj-000UbQ-BN@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: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Detect more overflows in timestamp[tz]_pl_interval.
  In-Reply-To: <E1s18Xj-000UbQ-BN@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