Bufmgr possible overflow - Mailing list pgsql-hackers

From Ranier Vilela
Subject Bufmgr possible overflow
Date
Msg-id CAEudQAr_oWHpZk4uumZijYS362gp4KHAah-yUe08CQY4a4SsOQ@mail.gmail.com
Whole thread Raw
Responses Re: Bufmgr possible overflow
List pgsql-hackers
Hi,

IMO I think that commit 31966b1 has an oversight.

All the logic of the changes are based on the "extend_by" variable, which is a uint32, but in some places it is using "int", which can lead to an overflow at some point.

I also take the opportunity to correct another oversight, regarding the commit dad50f6,
for possible duplicate assignment.
GetLocalBufferDescriptor was called twice.

Taking advantage of this, I promoted a scope reduction for some variables, which I thought was opportune.

Patch attached.

regards,
Ranier Vilela
Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: v12: ERROR: subplan "InitPlan 2 (returns $4)" was not initialized
Next
From: Andrew Dunstan
Date:
Subject: Re: Direct I/O