Re: Protect against possible memory corruption (src/backend/access/nbtree/nbtxlog.c)

2021-07-12 Thread Ranier Vilela
Em seg., 12 de jul. de 2021 às 05:20, Heikki Linnakangas escreveu: > On 12/07/2021 02:34, Ranier Vilela wrote: > > If it is not possible, know the upper limits, before the loop. > > It is necessary to do this inside the loop. > > > @@ -49,10 +47,14 @@ _bt_restore_page(Page page, char *from, int l

Re: Protect against possible memory corruption (src/backend/access/nbtree/nbtxlog.c)

2021-07-12 Thread Heikki Linnakangas
On 12/07/2021 02:34, Ranier Vilela wrote: If it is not possible, know the upper limits, before the loop. It is necessary to do this inside the loop. @@ -49,10 +47,14 @@ _bt_restore_page(Page page, char *from, int len) * To get the items back in the original order, we add them to the p

Re: Protect against possible memory corruption (src/backend/access/nbtree/nbtxlog.c)

2021-07-11 Thread Ranier Vilela
Em dom., 11 de jul. de 2021 às 19:19, Heikki Linnakangas escreveu: > On 11/07/2021 22:51, Ranier Vilela wrote: > > Hi, > > > > While analyzing a possible use of an uninitialized variable, I checked > that > > *_bt_restore_page* can lead to memory corruption, > > by not checking the maximum limit

Re: Protect against possible memory corruption (src/backend/access/nbtree/nbtxlog.c)

2021-07-11 Thread Heikki Linnakangas
On 11/07/2021 22:51, Ranier Vilela wrote: Hi, While analyzing a possible use of an uninitialized variable, I checked that *_bt_restore_page* can lead to memory corruption, by not checking the maximum limit of array items which is MaxIndexTuplesPerPage. + /* Protect against corrupted rec

Protect against possible memory corruption (src/backend/access/nbtree/nbtxlog.c)

2021-07-11 Thread Ranier Vilela
Hi, While analyzing a possible use of an uninitialized variable, I checked that *_bt_restore_page* can lead to memory corruption, by not checking the maximum limit of array items which is MaxIndexTuplesPerPage. It can also generate a dangling pointer by incrementing it beyond the limits it can po