pgsql: Don't call PageGetSpecialPointer() on page until it's been initi - Mailing list pgsql-committers

From Heikki Linnakangas
Subject pgsql: Don't call PageGetSpecialPointer() on page until it's been initi
Date
Msg-id E1Z9t6L-0006tv-IJ@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Don't call PageGetSpecialPointer() on page until it's been initialized.

After calling XLogInitBufferForRedo(), the page might be all-zeros if it was
not in page cache already. btree_xlog_unlink_page initialized the page
correctly, but it called PageGetSpecialPointer before initializing it, which
would lead to a corrupt page at WAL replay, if the unlinked page is not in
page cache.

Backpatch to 9.4, the bug came with the rewrite of B-tree page deletion.

Branch
------
REL9_4_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/7dc721889b31450cad338a189a97ff0ff46534d5

Modified Files
--------------
src/backend/access/nbtree/nbtxlog.c |    3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)


pgsql-committers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: pgsql: Add assertion to check the special size is sane before dereferen
Next
From: Tom Lane
Date:
Subject: pgsql: Remove useless check for NULL subexpression.