From: Tom Lane Date: Sun, 10 Feb 2008 20:39:08 +0000 (+0000) Subject: Fix PageGetExactFreeSpace() so that it actually behaves sensibly X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=9524d735275d7f5869a11b84bc437efa839ea38c;p=users%2Fbernd%2Fpostgres.git Fix PageGetExactFreeSpace() so that it actually behaves sensibly if pd_lower > pd_upper, rather than merely claiming to. This would only matter if the page header were corrupt, which shouldn't occur, but ... --- diff --git a/src/backend/storage/page/bufpage.c b/src/backend/storage/page/bufpage.c index f34dd7e7b7..eea03deaa7 100644 --- a/src/backend/storage/page/bufpage.c +++ b/src/backend/storage/page/bufpage.c @@ -489,6 +489,9 @@ PageGetExactFreeSpace(Page page) space = (int) ((PageHeader) page)->pd_upper - (int) ((PageHeader) page)->pd_lower; + if (space < 0) + return 0; + return (Size) space; }