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