Re: Fix infinite loop from setting scram_iterations to INT_MAX

2025-04-05 Thread Richard Guo
On Mon, Mar 24, 2025 at 9:59 AM Richard Guo wrote: > On Mon, Mar 24, 2025 at 9:54 AM Michael Paquier wrote: > > On Mon, Mar 24, 2025 at 09:50:36AM +0900, Richard Guo wrote: > > > Nice catch. The fix looks good to me. It seems to me that it's fine > > > to go without a test case, since the fix i

Re: Fix infinite loop from setting scram_iterations to INT_MAX

2025-04-04 Thread Michael Paquier
On Wed, Mar 26, 2025 at 03:41:10PM +0900, Richard Guo wrote: > I plan to go ahead and push Kevin's fix, barring any objections. Thanks, Richard. -- Michael signature.asc Description: PGP signature

Re: Fix infinite loop from setting scram_iterations to INT_MAX

2025-03-26 Thread Daniel Gustafsson
> On 26 Mar 2025, at 07:41, Richard Guo wrote: > I plan to go ahead and push Kevin's fix, barring any objections. Thanks for picking this up, I had missed this thread. -- Daniel Gustafsson

Re: Fix infinite loop from setting scram_iterations to INT_MAX

2025-03-23 Thread Richard Guo
On Mon, Mar 24, 2025 at 9:54 AM Michael Paquier wrote: > On Mon, Mar 24, 2025 at 09:50:36AM +0900, Richard Guo wrote: > > Nice catch. The fix looks good to me. It seems to me that it's fine > > to go without a test case, since the fix is quite straightforward. > > One could argue about using an

Re: Fix infinite loop from setting scram_iterations to INT_MAX

2025-03-23 Thread Michael Paquier
On Mon, Mar 24, 2025 at 09:50:36AM +0900, Richard Guo wrote: > Nice catch. The fix looks good to me. It seems to me that it's fine > to go without a test case, since the fix is quite straightforward. One could argue about using an injection point to force trick the iteration loop to be cheaper,

Re: Fix infinite loop from setting scram_iterations to INT_MAX

2025-03-23 Thread Richard Guo
On Sun, Mar 23, 2025 at 10:41 PM Kevin K Biju wrote: > int i; > ... > for (i = 2; i <= iterations; i++) > { > ... > } > > For iterations = INT_MAX, the loop will never terminate since the condition > is <= and adding 1 to INT_MAX will lead to i wrapping around to INT_MIN. > > I've fixed this

Fix infinite loop from setting scram_iterations to INT_MAX

2025-03-23 Thread Kevin K Biju
Hi, I stumbled upon a problem with the scram_iterations GUC where setting scram_iterations to INT_MAX and then creating a user causes the command to hang indefinitely. postgres=# SET scram_iterations=2147483647; SET postgres=# CREATE ROLE maxscram WITH PASSWORD 'forever'; I looked into the rele