Summary
range_search() on any DynamicVamanaIndex crashes when a single query returns >= 65,536 results (2^16). The runtime internally narrows the per-query result count to uint16_t, which overflows and throws svs::lib::narrowing_error. Because range_search() is noexcept, this calls std::terminate().
All storage kinds are affected (FP32, FP16, LVQ, LeanVec) — the bug is in the core range search path inside libsvs_runtime.so.
Version: v0.1.0 (svs-cpp-runtime-bindings-0.1.0.tar.gz)
Steps to Reproduce
Generate 100K random 768D vectors, build a DynamicVamanaIndex, and run range_search with a radius large enough to match >65K vectors:
#include <svs/runtime/dynamic_vamana_index.h>
// ... build index with 100,000 vectors (768D, L2) ...
// range_search with radius=550 -> ~98K vectors match -> CRASH
A full standalone reproducer (FAISS-based, ~150 lines) is attached
d_reproduce_range_search_crash.cpp
Crash output:
terminate called after throwing an instance of 'svs::lib::narrowing_error'
what(): narrowing_error
Aborted (core dumped)
Evidence: Crash Threshold Is Exactly 2^16
Search over radius values with 100K random vectors (768D, L2, FP32):
| Radius |
Result Count |
Status |
| 519.30 |
65,209 |
OK |
| 519.35 |
>= 65,536 |
CRASH |
The boundary is exactly 65,536 = UINT16_MAX + 1. Below this threshold, all queries succeed. At or above, every query crashes.
FAISS's own IndexFlatL2 and IndexHNSW handle the same data and radius correctly, returning >65K results without issue.
Expected Behavior
range_search() should handle any result count. The internal per-query result counter should use size_t (or at minimum uint32_t) instead of uint16_t.
Environment
- Ubuntu 24.04, GCC 13.3.0, C++20
- AWS r8i.4xlarge
- Also reproduced via OpenSearch 3.4.0 with FAISS SVS integration (manifests as
SIGSEGV in libsvs_runtime.so+0x2b69a2)
Summary
range_search()on anyDynamicVamanaIndexcrashes when a single query returns >= 65,536 results (2^16). The runtime internally narrows the per-query result count touint16_t, which overflows and throwssvs::lib::narrowing_error. Becauserange_search()isnoexcept, this callsstd::terminate().All storage kinds are affected (FP32, FP16, LVQ, LeanVec) — the bug is in the core range search path inside
libsvs_runtime.so.Version: v0.1.0 (
svs-cpp-runtime-bindings-0.1.0.tar.gz)Steps to Reproduce
Generate 100K random 768D vectors, build a
DynamicVamanaIndex, and runrange_searchwith a radius large enough to match >65K vectors:A full standalone reproducer (FAISS-based, ~150 lines) is attached
d_reproduce_range_search_crash.cpp
Crash output:
Evidence: Crash Threshold Is Exactly 2^16
Search over radius values with 100K random vectors (768D, L2, FP32):
The boundary is exactly 65,536 = UINT16_MAX + 1. Below this threshold, all queries succeed. At or above, every query crashes.
FAISS's own
IndexFlatL2andIndexHNSWhandle the same data and radius correctly, returning >65K results without issue.Expected Behavior
range_search()should handle any result count. The internal per-query result counter should usesize_t(or at minimumuint32_t) instead ofuint16_t.Environment
SIGSEGVinlibsvs_runtime.so+0x2b69a2)