Re: Integer undeflow in fprintf in dsa.c

2024-02-20 Thread Daniel Gustafsson
> On 20 Feb 2024, at 17:13, Ilyasov Ian wrote: > Sorry for not answering quickly. There is no need for any apology, there is no obligation to answer within any specific timeframe. > I attached a patch to the letter with changes to take into account Daniel > Gustafsson's comment. Looks good on

RE: Integer undeflow in fprintf in dsa.c

2024-02-20 Thread Ilyasov Ian
Sorry for not answering quickly. Thank you for your comments. I attached a patch to the letter with changes to take into account Daniel Gustafsson's comment. Kind regards, Ian Ilyasov. Juniour Software Developer at Postgres Professional Subject: [PATCH] Integer underflow fix in fprintf in dsa

Re: Integer undeflow in fprintf in dsa.c

2024-02-20 Thread Robert Haas
On Tue, Feb 20, 2024 at 5:30 PM Daniel Gustafsson wrote: > The message "at least 0 contiguous pages free" reads a bit nonsensical though, > wouldn't it be preferrable to check for i being zero and print a custom > message > for that case? Something like the below untested sketch? > > +

Re: Integer undeflow in fprintf in dsa.c

2024-02-20 Thread Daniel Gustafsson
> On 20 Feb 2024, at 12:28, Ильясов Ян wrote: > ​fprintf(stderr, >"segment bin %zu (at least %d contiguous pages free):\n", >i, 1 << (i - 1)); > > In case i​ equals zero user will get "at least -2147483648 contiguous pages > free". That does indeed seem like an over