Re: [HACKERS] pageinspect: Hash index support
От | Ashutosh Sharma |
---|---|
Тема | Re: [HACKERS] pageinspect: Hash index support |
Дата | |
Msg-id | CAE9k0PmzAQKdtft_DGii+f=ZbN-bd452EnRKF0EzNRa1_xazSw@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: [HACKERS] pageinspect: Hash index support (Robert Haas <robertmhaas@gmail.com>) |
Список | pgsql-hackers |
> + 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
В списке pgsql-hackers по дате отправления: