Skip to content
This repository has been archived by the owner on Aug 16, 2023. It is now read-only.

Commit

Permalink
Fix DiskANN Access Invalid Address when Query with Bitset (#798)
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick Weizhi Xu <[email protected]>
  • Loading branch information
PwzXxm authored Apr 3, 2023
1 parent 1811195 commit 7156af0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion thirdparty/DiskANN/include/diskann/neighbor.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,14 @@ namespace diskann {
static inline unsigned InsertIntoPool(Neighbor *addr, int K,
Neighbor nn) {
// find the location to insert
assert(K >= 0);
int left = 0, right = K - 1;
if (addr[left].distance > nn.distance) {
memmove((char *) &addr[left + 1], &addr[left], K * sizeof(Neighbor));
addr[left] = nn;
return left;
}
if (addr[right].distance < nn.distance) {
if (K == 0 || addr[right].distance < nn.distance) {
addr[K] = nn;
return K;
}
Expand Down

0 comments on commit 7156af0

Please sign in to comment.