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: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Fix possible bogus array out of bonds (src/backend/access/brin/brin_minmax_multi.c)
Date: 2022-08-26 13:28:50
Message-ID: CAEudQAqJQzPitufX-jR=YUbJafpCDAKUnwgdbX_MzSc93wuvdw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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 to zero, there is no need to initialize minvalue and
maxvalue.

The patch tries to fix it, avoiding possible errors by using maxvalue.

regards,
Ranier Vilela

Attachment Content-Type Size
0001-fix-bogus-possible-array-out-bonds.patch application/octet-stream 910 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2022-08-26 13:33:05 Re: standby promotion can create unreadable WAL
Previous Message Andres Freund 2022-08-26 13:21:51 Re: windows cfbot failing: my_perl