Re: Fix possible bogus array out of bonds (src/backend/access/brin/brin_minmax_multi.c)

2022-09-13 Thread Ranier Vilela
Em seg., 5 de set. de 2022 às 23:02, David Rowley escreveu: > On Tue, 6 Sept 2022 at 13:52, Ranier Vilela wrote: > > > > Em seg., 5 de set. de 2022 às 22:29, David Rowley > escreveu: > >> It feels like it would be good if we had a way to detect a few of > >> these issues much earlier than we ar

Re: Fix possible bogus array out of bonds (src/backend/access/brin/brin_minmax_multi.c)

2022-09-12 Thread Ranier Vilela
Em seg., 12 de set. de 2022 às 20:06, David Rowley escreveu: > On Tue, 6 Sept 2022 at 13:29, David Rowley wrote: > > I'll hold off a few days before pushing the other patch. Tom stamped > > beta4 earlier, so I'll hold off until after the tag. > > I've now pushed this. > Thank you David. But the

Re: Fix possible bogus array out of bonds (src/backend/access/brin/brin_minmax_multi.c)

2022-09-12 Thread David Rowley
On Tue, 6 Sept 2022 at 13:29, David Rowley wrote: > I'll hold off a few days before pushing the other patch. Tom stamped > beta4 earlier, so I'll hold off until after the tag. I've now pushed this. David

Re: Fix possible bogus array out of bonds (src/backend/access/brin/brin_minmax_multi.c)

2022-09-06 Thread David Rowley
On Tue, 6 Sept 2022 at 23:25, Ranier Vilela wrote: > But first, I would like to continue with this correction of using strings. > In the following cases: > fprintf -> fputs -> fputc > printf -> puts -> putchar > > There are many occurrences, do you think it would be worth the effort? I'm pretty u

Re: Fix possible bogus array out of bonds (src/backend/access/brin/brin_minmax_multi.c)

2022-09-06 Thread Ranier Vilela
Em seg., 5 de set. de 2022 às 23:02, David Rowley escreveu: > On Tue, 6 Sept 2022 at 13:52, Ranier Vilela wrote: > > > > Em seg., 5 de set. de 2022 às 22:29, David Rowley > escreveu: > >> It feels like it would be good if we had a way to detect a few of > >> these issues much earlier than we ar

Re: Fix possible bogus array out of bonds (src/backend/access/brin/brin_minmax_multi.c)

2022-09-05 Thread David Rowley
On Tue, 6 Sept 2022 at 13:52, Ranier Vilela wrote: > > Em seg., 5 de set. de 2022 às 22:29, David Rowley > escreveu: >> It feels like it would be good if we had a way to detect a few of >> these issues much earlier than we are currently. There's been a long >> series of commits fixing up this s

Re: Fix possible bogus array out of bonds (src/backend/access/brin/brin_minmax_multi.c)

2022-09-05 Thread Ranier Vilela
Em seg., 5 de set. de 2022 às 22:29, David Rowley escreveu: > On Tue, 6 Sept 2022 at 06:07, Ranier Vilela wrote: > > I did a search and found a few more places. > > v1 attached. > > Thanks. I've done a bit more looking and found a few more places that > we can improve and I've pushed the result

Re: Fix possible bogus array out of bonds (src/backend/access/brin/brin_minmax_multi.c)

2022-09-05 Thread David Rowley
On Tue, 6 Sept 2022 at 06:07, Ranier Vilela wrote: > I did a search and found a few more places. > v1 attached. Thanks. I've done a bit more looking and found a few more places that we can improve and I've pushed the result. It feels like it would be good if we had a way to detect a few of thes

Re: Fix possible bogus array out of bonds (src/backend/access/brin/brin_minmax_multi.c)

2022-09-05 Thread Ranier Vilela
Em seg., 5 de set. de 2022 às 10:40, David Rowley escreveu: > On Mon, 5 Sept 2022 at 22:15, David Rowley wrote: > > On Sat, 3 Sept 2022 at 00:37, Ranier Vilela wrote: > > > 6. Avoid overhead when using unnecessary StringInfoData to convert > Datum a to Text b. > > > > I've ripped out #4 and #6

Re: Fix possible bogus array out of bonds (src/backend/access/brin/brin_minmax_multi.c)

2022-09-05 Thread David Rowley
On Mon, 5 Sept 2022 at 22:15, David Rowley wrote: > On Sat, 3 Sept 2022 at 00:37, Ranier Vilela wrote: > > 6. Avoid overhead when using unnecessary StringInfoData to convert Datum a > > to Text b. > > I've ripped out #4 and #6 for now. I think we should do #6 in master > only, probably as part o

Re: Fix possible bogus array out of bonds (src/backend/access/brin/brin_minmax_multi.c)

2022-09-05 Thread Ranier Vilela
Em seg., 5 de set. de 2022 às 07:15, David Rowley escreveu: > On Sat, 3 Sept 2022 at 00:37, Ranier Vilela wrote: > >> But +1 to fix this and other issues even if they would never crash. > > Yeah, I don't think any of this coding would lead to a crash, but it's > pretty weird coding and we should

Re: Fix possible bogus array out of bonds (src/backend/access/brin/brin_minmax_multi.c)

2022-09-05 Thread David Rowley
On Sat, 3 Sept 2022 at 00:37, Ranier Vilela wrote: >> But +1 to fix this and other issues even if they would never crash. Yeah, I don't think any of this coding would lead to a crash, but it's pretty weird coding and we should fix it. > 1. Once that ranges->nranges is invariant, avoid the loop i

Re: Fix possible bogus array out of bonds (src/backend/access/brin/brin_minmax_multi.c)

2022-09-02 Thread Ranier Vilela
Em sex., 2 de set. de 2022 às 09:01, Justin Pryzby escreveu: > On Mon, Aug 29, 2022 at 10:06:55AM +0900, Kyotaro Horiguchi wrote: > > At Fri, 26 Aug 2022 10:28:50 -0300, Ranier Vilela > wrote in > > > At function has_matching_range, if variable ranges->nranges == 0, > > > we exit quickly with a

Re: Fix possible bogus array out of bonds (src/backend/access/brin/brin_minmax_multi.c)

2022-09-02 Thread Justin Pryzby
On Mon, Aug 29, 2022 at 10:06:55AM +0900, Kyotaro Horiguchi wrote: > At Fri, 26 Aug 2022 10:28:50 -0300, Ranier Vilela wrote > in > > At function has_matching_range, if variable ranges->nranges == 0, > > we exit quickly with a result equal to false. > > > > This means that nranges can be zero.

Re: Fix possible bogus array out of bonds (src/backend/access/brin/brin_minmax_multi.c)

2022-09-01 Thread David Rowley
On Fri, 2 Sept 2022 at 12:55, Ranier Vilela wrote: > Why not? > astate_values = accumArrayResult(astate_values, > PointerGetDatum(a), > false, > TEXTOID, > CurrentMemoryContext); > > Is it possibl

Re: Fix possible bogus array out of bonds (src/backend/access/brin/brin_minmax_multi.c)

2022-09-01 Thread Ranier Vilela
Em qui., 1 de set. de 2022 às 21:27, David Rowley escreveu: > On Sat, 27 Aug 2022 at 01:29, Ranier Vilela wrote: > > At function has_matching_range, if variable ranges->nranges == 0, > > we exit quickly with a result equal to false. > > > > This means that nranges can be zero. > > It occurs then

Re: Fix possible bogus array out of bonds (src/backend/access/brin/brin_minmax_multi.c)

2022-09-01 Thread David Rowley
On Sat, 27 Aug 2022 at 01:29, Ranier Vilela wrote: > At function has_matching_range, if variable ranges->nranges == 0, > we exit quickly with a result equal to false. > > This means that nranges can be zero. > It occurs then that it is possible then to occur an array out of bonds, in > the initia

Re: Fix possible bogus array out of bonds (src/backend/access/brin/brin_minmax_multi.c)

2022-08-29 Thread Ranier Vilela
Em dom., 28 de ago. de 2022 às 22:06, Kyotaro Horiguchi < horikyota@gmail.com> escreveu: > At Fri, 26 Aug 2022 10:28:50 -0300, Ranier Vilela > wrote in > > At function has_matching_range, if variable ranges->nranges == 0, > > we exit quickly with a result equal to false. > > > > This means th

Re: Fix possible bogus array out of bonds (src/backend/access/brin/brin_minmax_multi.c)

2022-08-28 Thread Kyotaro Horiguchi
At Fri, 26 Aug 2022 10:28:50 -0300, Ranier Vilela wrote in > At function has_matching_range, if variable ranges->nranges == 0, > we exit quickly with a result equal to false. > > This means that nranges can be zero. > It occurs then that it is possible then to occur an array out of bonds, in >

Fix possible bogus array out of bonds (src/backend/access/brin/brin_minmax_multi.c)

2022-08-26 Thread Ranier Vilela
Hi, At function has_matching_range, if variable ranges->nranges == 0, we exit quickly with a result equal to false. This means that nranges can be zero. It occurs then that it is possible then to occur an array out of bonds, in the initialization of the variable maxvalue. So if nranges is equal t