mirror of
https://github.com/postgres/postgres.git
synced 2025-07-31 22:04:40 +03:00
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 ...
This commit is contained in:
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/storage/page/bufpage.c,v 1.77 2008/01/01 19:45:52 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/storage/page/bufpage.c,v 1.78 2008/02/10 20:39:08 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -489,6 +489,9 @@ PageGetExactFreeSpace(Page page)
|
|||||||
space = (int) ((PageHeader) page)->pd_upper -
|
space = (int) ((PageHeader) page)->pd_upper -
|
||||||
(int) ((PageHeader) page)->pd_lower;
|
(int) ((PageHeader) page)->pd_lower;
|
||||||
|
|
||||||
|
if (space < 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
return (Size) space;
|
return (Size) space;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user