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

From: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
To: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Fix possible bogus array out of bonds (src/backend/access/brin/brin_minmax_multi.c)
Date: 2022-08-29 12:51:28
Message-ID: CAEudQAqZDPprSYyVdWWWT8yxz_TE47npp0RpY4eARsVrC=QFQA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Em dom., 28 de ago. de 2022 às 22:06, Kyotaro Horiguchi <
horikyota(dot)ntt(at)gmail(dot)com> escreveu:

> At Fri, 26 Aug 2022 10:28:50 -0300, Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
> 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
> > the initialization of the variable maxvalue.
> > So if nranges is equal to zero, there is no need to initialize minvalue
> and
> > maxvalue.
> >
> > The patch tries to fix it, avoiding possible errors by using maxvalue.
>
> However it seems that nranges will never be zero, still the fix looks
> good to me since it is generally allowed to be zero. I don't find a
> similar mistake related to Range.nranges.
>
Thanks Kyotaro for taking a look at this.

regards,
Ranier Vilela

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2022-08-29 12:56:40 Re: SQL/JSON features for v15
Previous Message kuroda.hayato@fujitsu.com 2022-08-29 12:49:22 RE: patch: Add missing descriptions for rmgr APIs