Use VARSIZE_ANY instead of itemsize to avoid uninitialized bytes

This commit is contained in:
Andrew Kane
2024-04-23 23:52:02 -07:00
parent 281a74f54e
commit ad3f811fa3
2 changed files with 5 additions and 2 deletions

View File

@@ -523,10 +523,13 @@ CreateListPages(Relation index, VectorArray centers, int dimensions,
{
OffsetNumber offno;
/* Zero memory for each list */
MemSet(list, 0, listSize);
/* Load list */
list->startPage = InvalidBlockNumber;
list->insertPage = InvalidBlockNumber;
memcpy(&list->center, VectorArrayGet(centers, i), centers->itemsize);
memcpy(&list->center, VectorArrayGet(centers, i), VARSIZE_ANY(VectorArrayGet(centers, i)));
/* Ensure free space */
if (PageGetFreeSpace(page) < listSize)