RE: [PATCH] Fix possible underflow in expression (maxoff - 1)

2019-12-18 Thread Ranier Vilela
De: Thomas Munro Enviado: quarta-feira, 18 de dezembro de 2019 00:18 >If you're working on/with static code analysis tools, I have some >requests :-) How could we automate the discovery of latch wait >programming mistakes? I doubt that static analysis can help with this problem. This seems to me

Re: [PATCH] Fix possible underflow in expression (maxoff - 1)

2019-12-17 Thread Thomas Munro
On Mon, Nov 25, 2019 at 8:21 AM Ranier Vilela wrote: > >Where are you getting this stuff from? Are you using a static analysis tool? > Yes,two static tools, but reviewed by me. If you're working on/with static code analysis tools, I have some requests :-) How could we automate the discovery of

Re: [PATCH] Fix possible underflow in expression (maxoff - 1)

2019-11-24 Thread Peter Geoghegan
On Sun, Nov 24, 2019 at 12:02 PM Ranier Vilela wrote: > I've been programming in C for a long time, and I'm getting better every day, > I believe. > I'll arrive there. If you don't understand the *specific* C code in question, you're unlikely to successfully diagnose a problem with the C code. R

RE: [PATCH] Fix possible underflow in expression (maxoff - 1)

2019-11-24 Thread Ranier Vilela
>I think that you're being far too optimistic about your ability to >detect and report valid issues using these static analysis tools. It's >not possible to apply the information they provide without a high l>evel understanding of the design of the code. There are already quite >a few full time Pos

Re: [PATCH] Fix possible underflow in expression (maxoff - 1)

2019-11-24 Thread Peter Geoghegan
On Sun, Nov 24, 2019 at 11:21 AM Ranier Vilela wrote: > >In general, it's not possible to split a page without it being > >initialized, and having at least 2 items (not including the incoming > >newitem). Besides, even if "maxoff" had an integer underflow the > >behavior of the function would stil

RE: [PATCH] Fix possible underflow in expression (maxoff - 1)

2019-11-24 Thread Ranier Vilela
>In general, it's not possible to split a page without it being >initialized, and having at least 2 items (not including the incoming >newitem). Besides, even if "maxoff" had an integer underflow the >behavior of the function would still be sane and defined. OffsetNumber >is an unsigned type. Well,

Re: [PATCH] Fix possible underflow in expression (maxoff - 1)

2019-11-24 Thread Peter Geoghegan
On Sun, Nov 24, 2019 at 9:58 AM Ranier Vilela wrote: > Within the function _bt_afternewitemoff, at line 641, maxoff is used in an > dangerous expression, > without protection.: (maxoff - 1) I wrote this code. It's safe. In general, it's not possible to split a page without it being initialized