Fix uninitialized variable access (src/backend/utils/mmgr/freepage.c)

From: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Fix uninitialized variable access (src/backend/utils/mmgr/freepage.c)
Date: 2021-07-01 19:42:41
Message-ID: CAEudQApiF6K4Vy0=0RYfz0Qy+=irGzne1YTnTiWE4XG3Joxuvw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

The function FreePageManagerPutInternal can access an uninitialized
variable,
if the following conditions occur:

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.

/* 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

Attachment Content-Type Size
fix_unitialized_var_index_freepage.patch application/octet-stream 389 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dean Rasheed 2021-07-01 19:45:04 Re: rand48 replacement
Previous Message Peter Eisentraut 2021-07-01 19:39:16 Re: make world and install-world without docs