Re: oauth integer overflow

From: Jacob Champion <jacob(dot)champion(at)enterprisedb(dot)com>
To: Daniel Gustafsson <daniel(at)yesql(dot)se>
Cc: Andres Freund <andres(at)anarazel(dot)de>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: oauth integer overflow
Date: 2026-06-05 19:06:27
Message-ID: CAOYmi+kKqSrU5c8D60rgSj6ybiNwsZkxgTJhef+w0-mRpw=m0A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Apr 23, 2026 at 11:31 AM Jacob Champion
<jacob(dot)champion(at)enterprisedb(dot)com> wrote:
> Attached. The static_assert for the millisecond calculation is the
> only part I don't really like, but doing an overflow check on a
> calculation that can't overflow int64 is even more verbose/wasteful.

I was preparing to commit this for beta1 last week, and I realized
that I've changed my tune. With all the recent backports of overflow
checks, I think I need to be reaching for them by default, especially
in a non-performance-critical path.

v2 rewrites that part with a checked multiplication, which removes any
need for a static_assert complication.

On Tue, Apr 28, 2026 at 4:18 AM Daniel Gustafsson <daniel(at)yesql(dot)se> wrote:
> When teading "disabled timer" I interpret that as a timer which is 0 and has no
> interval (which might be due to not being a native speaker), but what it
> actually describes is an interval which (in practice) never ends. Perhaps it
> could be phrased more like "for most people is going to be equivalent to a
> never ending interval".

This has been completely rewritten now; see what you think.

Thanks!
--Jacob

Attachment Content-Type Size
v2-0001-libpq-oauth-Avoid-overflow-for-very-large-interva.patch application/octet-stream 3.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Baji Shaik 2026-06-05 19:17:01 Re: First draft of PG 19 release notes
Previous Message Bruce Momjian 2026-06-05 18:58:41 Re: First draft of PG 19 release notes