projects
/
postgresql-pgindent.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
fdf2885
)
Add assertion to check the special size is sane before dereferencing it.
author
Heikki Linnakangas
<
[email protected]
>
Tue, 30 Jun 2015 10:44:04 +0000
(13:44 +0300)
committer
Heikki Linnakangas
<
[email protected]
>
Tue, 30 Jun 2015 10:44:04 +0000
(13:44 +0300)
This seems useful to catch errors of the sort I just fixed, where
PageGetSpecialPointer is called before initializing the page.
src/include/storage/bufpage.h
patch
|
blob
|
blame
|
history
diff --git
a/src/include/storage/bufpage.h
b/src/include/storage/bufpage.h
index c2fbffc8e9b72c71addab4a4ad028792d38c70a8..a2f78ee56ce9e8c045b0a6b3bfd639a92fa8959d 100644
(file)
--- a/
src/include/storage/bufpage.h
+++ b/
src/include/storage/bufpage.h
@@
-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) \
)