File tree Expand file tree Collapse file tree 1 file changed +20
-3
lines changed Expand file tree Collapse file tree 1 file changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -297,15 +297,32 @@ typedef PageHeaderData *PageHeader;
297297#define PageGetSpecialSize (page ) \
298298 ((uint16) (PageGetPageSize(page) - ((PageHeader)(page))->pd_special))
299299
300+ /*
301+ * Using assertions, validate that the page special pointer is OK.
302+ *
303+ * This is intended to catch use of the pointer before page initialization.
304+ * It is implemented as a function do to the limitations of the MSVC compiler,
305+ * which choked on doing all these tests within another macro. We return true
306+ * so that MacroAssert() can be used while still getting the specifics from
307+ * the macro failure within this function.
308+ */
309+ static inline bool
310+ PageValidateSpecialPointer (Page page )
311+ {
312+ Assert (PageIsValid (page ));
313+ Assert (((PageHeader ) (page ))-> pd_special <= BLCKSZ );
314+ Assert (((PageHeader ) (page ))-> pd_special >= SizeOfPageHeaderData );
315+
316+ return true;
317+ }
318+
300319/*
301320 * PageGetSpecialPointer
302321 * Returns pointer to special space on a page.
303322 */
304323#define PageGetSpecialPointer (page ) \
305324( \
306- AssertMacro(PageIsValid(page)), \
307- AssertMacro(((PageHeader) (page))->pd_special <= BLCKSZ), \
308- AssertMacro(((PageHeader) (page))->pd_special >= SizeOfPageHeaderData), \
325+ AssertMacro(PageValidateSpecialPointer(page)), \
309326 (char *) ((char *) (page) + ((PageHeader) (page))->pd_special) \
310327)
311328
You can’t perform that action at this time.
0 commit comments