From: Vadim B. Mikheev Date: Tue, 6 Feb 2001 06:24:00 +0000 (+0000) Subject: PageAddItem in overwrite mode: must *NOT* check itemid' flag if X-Git-Tag: REL7_1~571 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=21d08bc1f606bbd840206b1846fa65fc9e1abab0;p=postgresql PageAddItem in overwrite mode: must *NOT* check itemid' flag if OffsetNumber == MaxOffsetNumber + 1 - there may be garbage there! --- diff --git a/src/backend/storage/page/bufpage.c b/src/backend/storage/page/bufpage.c index 02022f9333..02528a30e6 100644 --- a/src/backend/storage/page/bufpage.c +++ b/src/backend/storage/page/bufpage.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/storage/page/bufpage.c,v 1.35 2001/01/24 19:43:08 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/page/bufpage.c,v 1.36 2001/02/06 06:24:00 vadim Exp $ * *------------------------------------------------------------------------- */ @@ -112,12 +112,15 @@ PageAddItem(Page page, elog(NOTICE, "PageAddItem: tried overwrite after maxoff"); return InvalidOffsetNumber; } - itemId = &((PageHeader) page)->pd_linp[offsetNumber - 1]; - if (((*itemId).lp_flags & LP_USED) || - ((*itemId).lp_len != 0)) + if (offsetNumber < limit) { - elog(NOTICE, "PageAddItem: tried overwrite of used ItemId"); - return InvalidOffsetNumber; + itemId = &((PageHeader) page)->pd_linp[offsetNumber - 1]; + if (((*itemId).lp_flags & LP_USED) || + ((*itemId).lp_len != 0)) + { + elog(NOTICE, "PageAddItem: tried overwrite of used ItemId"); + return InvalidOffsetNumber; + } } } else