Skip to content

Commit 302ac7f

Browse files
committed
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.
1 parent fdf2885 commit 302ac7f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/include/storage/bufpage.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,8 @@ typedef PageHeaderData *PageHeader;
304304
#define PageGetSpecialPointer(page) \
305305
( \
306306
AssertMacro(PageIsValid(page)), \
307+
AssertMacro(((PageHeader) (page))->pd_special <= BLCKSZ), \
308+
AssertMacro(((PageHeader) (page))->pd_special >= SizeOfPageHeaderData), \
307309
(char *) ((char *) (page) + ((PageHeader) (page))->pd_special) \
308310
)
309311

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy