mirror of
https://github.com/asg017/sqlite-vec.git
synced 2026-04-25 16:56:27 +02:00
Initialize rescore distance variable to FLT_MAX
The `dist` variable in rescore KNN quantized distance computation was uninitialized. If the switch on quantizer_type or distance_metric didn't match any case, the uninitialized value would propagate into the top-k heap, potentially returning garbage results. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
82f4eb08bf
commit
5e4c557f93
1 changed files with 1 additions and 1 deletions
|
|
@ -465,7 +465,7 @@ static int rescore_knn(vec0_vtab *p, vec0_cursor *pCur,
|
|||
for (int j = 0; j < p->chunk_size; j++) {
|
||||
if (!bitmap_get(b, j))
|
||||
continue;
|
||||
f32 dist;
|
||||
f32 dist = FLT_MAX;
|
||||
switch (vector_column->rescore.quantizer_type) {
|
||||
case VEC0_RESCORE_QUANTIZER_BIT: {
|
||||
const u8 *base_j = ((u8 *)baseVectors) + (j * (qdim / CHAR_BIT));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue