Commit 302ac7f2 authored by Heikki Linnakangas's avatar Heikki Linnakangas

Add assertion to check the special size is sane before dereferencing it.

This seems useful to catch errors of the sort I just fixed, where
PageGetSpecialPointer is called before initializing the page.
parent fdf28853
......@@ -304,6 +304,8 @@ typedef PageHeaderData *PageHeader;
#define PageGetSpecialPointer(page) \
( \
AssertMacro(PageIsValid(page)), \
AssertMacro(((PageHeader) (page))->pd_special <= BLCKSZ), \
AssertMacro(((PageHeader) (page))->pd_special >= SizeOfPageHeaderData), \
(char *) ((char *) (page) + ((PageHeader) (page))->pd_special) \
)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment