> + itup = (IndexTuple) PageGetItem(uargs->page, id); > + > + MemSet(nulls, 0, sizeof(nulls)); > + > + j = 0; > + values[j++] = UInt16GetDatum(uargs->offset); > + values[j++] = CStringGetTextDatum(psprintf("(%u,%u)", > + > BlockIdGetBlockNumber(&(itup->t_tid.ip_blkid)), > + itup->t_tid.ip_posid)); > + > + ptr = (char *) itup + IndexInfoFindDataOffset(itup->t_info); > + dlen = IndexTupleSize(itup) - IndexInfoFindDataOffset(itup->t_info); > > It seems like this could be used to index off the end of the page, if > you feed it invalid data. >
I think it should not exceed the page size. This is how it has been implemented for btree as well. However, just to be on a safer side i am planning to add following 'if check' to ensure that we do not go beyond the page size while reading tuples. ptr = (char *) itup + IndexInfoFindDataOffset(itup->t_info); + if (ptr > page + BLCKSZ) + /* Error */ dlen = IndexTupleSize(itup) - IndexInfoFindDataOffset(itup->t_info); Meanwhile, I am working on other review comments and will try to share an updated patch asap. With Regards, Ashutosh Sharma EnterpriseDB:http://www.enterprisedb.com -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers