Re: Fix overflow in justify_interval related functions

From: Joseph Koshakow <koshy44(at)gmail(dot)com>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Fix overflow in justify_interval related functions
Date: 2022-02-15 01:35:43
Message-ID: CAAvxfHd1naq8NGyU10R1fG+nCQKcrrFBK3YfLuuGu1R7nB=Z7A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Feb 14, 2022 at 7:59 PM Nathan Bossart <nathandbossart(at)gmail(dot)com> wrote:
> I think it's possible to avoid overflow in justify_interval() in some cases
> by pre-justifying the days. I've attached a patch to demonstrate.
>
> --
> Nathan Bossart
> Amazon Web Services: https://aws.amazon.com

Good catch, I didn't think about that. Though if you are pre-justifying
the days, then I don't think it's possible for the second addition to
days to overflow. The maximum amount the days field could be after
the first justification is 29. I think we can simplify it further to the
attached patch.

- Joe

Attachment Content-Type Size
v3-0001-Check-for-overflow-in-justify_interval-functions.patch text/x-patch 6.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2022-02-15 01:47:33 Re: automatically generating node support functions
Previous Message Andres Freund 2022-02-15 01:32:46 Re: automatically generating node support functions