Re: oauth integer overflow - Mailing list pgsql-hackers

From Jacob Champion
Subject Re: oauth integer overflow
Date
Msg-id CAOYmi+mGZ5H+k_Y-ascgK7X9snAGdBUOuc=FZRxu6gnB_mjFFQ@mail.gmail.com
Whole thread
In response to Re: oauth integer overflow  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
On Thu, Apr 23, 2026 at 11:37 AM Andres Freund <andres@anarazel.de> wrote:
> How about instead making sure that actx->authz.interval never gets big enough
> to have any chance of overflowing during either the += 5 or the * 1000?  It's
> clearly ok to error out well before that...

It probably is, but I guess the approach depends on whether you prefer
checking at the time of operation, or attempting to reason about it
ahead of time in far-away code. With the latter, if additional math is
added in the future, then either the new overflow hazard gets missed,
or the ceiling gets lowered again, or the new math gets an overflow
check when the others don't. I prefer the time-of-use pattern,
personally.

--Jacob



pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: CheckAttributeType() forgot to recurse into multiranges
Next
From: Jeff Davis
Date:
Subject: Re: GUC parameter ACLs and physical walsender