Re: oauth integer overflow
Jacob Champion <jacob.champion@enterprisedb.com>
From: Jacob Champion <jacob.champion@enterprisedb.com>
To: Andres Freund <andres@anarazel.de>
Cc: Daniel Gustafsson <daniel@yesql.se>,
PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2026-04-23T19:05:32Z
Lists: 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