pgvector.git / summary / log / commit / refs
commit b79a05e533cb9c38282191950f6cccd4e9c4ce03
Author: Andrew Kane <andrew@ankane.org>
Date: Wed Jul 29 16:42:27 2026 +0000
Hardened HnswLoadNeighborTids [skip ci]
src/hnswutils.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/hnswutils.c b/src/hnswutils.c
index 3e287186..26331fc7 100644
--- a/src/hnswutils.c
+++ b/src/hnswutils.c
@@ -762,7 +762,7 @@ HnswLoadNeighborTids(HnswElement element, ItemPointerData *indextids, Relation i
Buffer buf;
Page page;
HnswNeighborTuple ntup;
- int start;
+ Size start;
buf = ReadBuffer(index, element->neighborPage);
LockBuffer(buf, BUFFER_LOCK_SHARE);
@@ -781,7 +781,7 @@ HnswLoadNeighborTids(HnswElement element, ItemPointerData *indextids, Relation i
}
/* Copy to minimize lock time */
- start = (element->level - lc) * m;
+ start = mul_size(element->level - lc, m);
memcpy(indextids, ntup->indextids + start, mul_size(sizeof(ItemPointerData), lm));
UnlockReleaseBuffer(buf);
[parent: 87f925a13949]