Re: Crash in BRIN minmax-multi indexes - Mailing list pgsql-hackers

From Tomas Vondra
Subject Re: Crash in BRIN minmax-multi indexes
Date
Msg-id c1a363f8-da2e-6a50-85e4-d10c929c8db2@enterprisedb.com
Whole thread Raw
In response to Re: Crash in BRIN minmax-multi indexes  (Zhihong Yu <zyu@yugabyte.com>)
List pgsql-hackers
On 4/1/21 12:53 AM, Zhihong Yu wrote:
> Hi,
> For inet data type fix:
> 
> +       unsigned char a = addra[i];
> +       unsigned char b = addrb[i];
> +
> +       if (i >= lena)
> +           a = 0;
> +
> +       if (i >= lenb)
> +           b = 0;
> 
> Should the length check precede the addra[i] ?
> Something like:
> 
>        unsigned char a;
>        if (i >= lena) a = 0;
>        else a = addra[i];
> 

I don't think that makes any difference. We know the bytes are there, we
just want to ignore / reset them in some cases.


regards

-- 
Tomas Vondra
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Zhihong Yu
Date:
Subject: Re: Crash in BRIN minmax-multi indexes
Next
From: Jaime Casanova
Date:
Subject: Re: Crash in BRIN minmax-multi indexes