Protect against possible memory corruption (src/backend/access/nbtree/nbtxlog.c) - Mailing list pgsql-hackers

From Ranier Vilela
Subject Protect against possible memory corruption (src/backend/access/nbtree/nbtxlog.c)
Date
Msg-id CAEudQAoWq+AL3BnELHu7gms2GN07k-np6yLbukGaxJ1vY-zeiQ@mail.gmail.com
Whole thread Raw
Responses Re: Protect against possible memory corruption (src/backend/access/nbtree/nbtxlog.c)  (Heikki Linnakangas <hlinnaka@iki.fi>)
List pgsql-hackers
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 point to.

While there, I promoted a reduction of scope and adaptation of the type of the *len* parameter to match XLogRecGetBlockData function.

pass regress check at Windows and check-world at Linux.

regards,
Ranier Vilela
Attachment

pgsql-hackers by date:

Previous
From: "Euler Taveira"
Date:
Subject: Re: row filtering for logical replication
Next
From: Heikki Linnakangas
Date:
Subject: Re: Protect against possible memory corruption (src/backend/access/nbtree/nbtxlog.c)