On Fri, 2 Jul 2021 at 01:13, Ranier Vilela <ranier...@gmail.com> wrote:
>
> Hi,
>
> The function FreePageManagerPutInternal can access an uninitialized
variable,
> if the following conditions occur:

Patch looks good to me.

> 1. fpm->btree_depth != 0
> 2. relptr_off == 0 inside function (FreePageBtreeSearch)
>
> Perhaps this is a rare situation, but I think it's worth preventing.

Please can we try to hit this rare condition by any test case. If you have
any test cases, please share.

1064 FreePageBtreeSearch(FreePageManager *fpm, Size first_page,


1065                     FreePageBtreeSearchResult *result)

1066 {

1067     char       *base = fpm_segment_base(fpm);

1068     FreePageBtree *btp = relptr_access(base, fpm->btree_root);

1069     Size        index;

1070

1071     result->split_pages = 1;

1072

1073     /* If the btree is empty, there's nothing to find. */

1074     if (*btp == NULL*)

1075     {

1076         result->page = NULL;

1077         result->found = false;

1078         return;

1079     }

>
> /* Search the btree. */
> FreePageBtreeSearch(fpm, first_page, &result);
> Assert(!result.found);
> if (result.index > 0)   /* result.index is garbage or invalid here) */
>
> regards,
> Ranier Vilela


-- 
Thanks and Regards
Mahendra Singh Thalor
EnterpriseDB: http://www.enterprisedb.com

Reply via email to