Fix possible bogus array out of bonds (src/backend/access/brin/brin_minmax_multi.c) - Mailing list pgsql-hackers

From Ranier Vilela
Subject Fix possible bogus array out of bonds (src/backend/access/brin/brin_minmax_multi.c)
Date
Msg-id CAEudQAqJQzPitufX-jR=YUbJafpCDAKUnwgdbX_MzSc93wuvdw@mail.gmail.com
Whole thread Raw
Responses Re: Fix possible bogus array out of bonds (src/backend/access/brin/brin_minmax_multi.c)
Re: Fix possible bogus array out of bonds (src/backend/access/brin/brin_minmax_multi.c)
List 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

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: windows cfbot failing: my_perl
Next
From: Robert Haas
Date:
Subject: Re: standby promotion can create unreadable WAL