Re: [PATCH] Fix Uninitialized scalar variable (UNINIT) (src/backend/access/heap/heapam_handler.c) - Mailing list pgsql-hackers

From Ranier Vilela
Subject Re: [PATCH] Fix Uninitialized scalar variable (UNINIT) (src/backend/access/heap/heapam_handler.c)
Date
Msg-id CAEudQAo7_bdBNSS5BAja1fL3fYVYNu5dHCF3yP_7_M4jYXjCiA@mail.gmail.com
Whole thread Raw
In response to Re: [PATCH] Fix Uninitialized scalar variable (UNINIT) (src/backend/access/heap/heapam_handler.c)  (Ranier Vilela <ranier.vf@gmail.com>)
Responses Re: [PATCH] Fix Uninitialized scalar variable (UNINIT) (src/backend/access/heap/heapam_handler.c)  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-hackers
Em ter., 25 de ago. de 2020 às 19:54, Ranier Vilela <ranier.vf@gmail.com> escreveu:
Em ter., 25 de ago. de 2020 às 19:45, Alvaro Herrera <alvherre@2ndquadrant.com> escreveu:
On 2020-Aug-25, Ranier Vilela wrote:

> If the variable hscan->rs_cblock is InvalidBlockNumber the test can
> protect root_offsets fail.

When does that happen?
At first pass into the while loop?
hscan->rs_cblock is InvalidBlockNumber, what happens?

Other things.
1. Even heap_get_root_tuples at line 1347, be called.
Does it fill all roots_offsets?
root_offsets[offnum - 1] is secure at this point (line 1641 or is trash)?

2. hscan->rs_cbuf is constant?
if (hscan->rs_cblock != root_blkno)
{
Page page = BufferGetPage(hscan->rs_cbuf);

LockBuffer(hscan->rs_cbuf, BUFFER_LOCK_SHARE);
heap_get_root_tuples(page, root_offsets);
LockBuffer(hscan->rs_cbuf, BUFFER_LOCK_UNLOCK);

root_blkno = hscan->rs_cblock;
}

This can move outside while loop?
Am I wrong or hscan do not change?

regards,
Ranier Vilela


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Strange behavior with polygon and NaN
Next
From: Alvaro Herrera
Date:
Subject: Re: [PATCH] Fix Uninitialized scalar variable (UNINIT) (src/backend/access/heap/heapam_handler.c)