Skip to content

Commit 082aca9

Browse files
committed
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 ...
1 parent 0028b22 commit 082aca9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/backend/storage/page/bufpage.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/storage/page/bufpage.c,v 1.77 2008/01/01 19:45:52 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/storage/page/bufpage.c,v 1.78 2008/02/10 20:39:08 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -489,6 +489,9 @@ PageGetExactFreeSpace(Page page)
489489
space = (int) ((PageHeader) page)->pd_upper -
490490
(int) ((PageHeader) page)->pd_lower;
491491

492+
if (space < 0)
493+
return 0;
494+
492495
return (Size) space;
493496
}
494497

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