You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#: 1
Severity: HIGH
File: distance-avx512.c:877
Fix: Removed (n+7)/8 — n is already byte count from all callers, matching CPU/NEON/SSE2/AVX2 backends
────────────────────────────────────────
#: 2
Severity: MEDIUM
File: sqlite-vector.c:1949
Fix: Added vector_allocated flag and sqlite3_free calls on all exit paths in vCursorFilterCommon when vector was allocated by vector_from_json
────────────────────────────────────────
#: 3
Severity: LOW
File: sqlite-vector.c:1194
Fix: Swapped the ternary branches so is_without_rowid==true gets the "must have INTEGER PRIMARY KEY" error and is_without_rowid==false gets the "Out of memory"
error
────────────────────────────────────────
#: 4
Severity: LOW
File: sqlite-vector.c:1058
Fix: Added KEY_MATCH macro that checks key_len == sizeof(key)-1 before strncasecmp, preventing prefix matches like "ty" matching "type"
if (strncasecmp(key, OPTION_KEY_TYPE, key_len) ==0) {
1058
+
1059
+
if (KEY_MATCH(OPTION_KEY_TYPE)) {
1059
1060
vector_typetype=vector_name_to_type(buffer);
1060
1061
if (type==0) returncontext_result_error(context, SQLITE_ERROR, "Invalid vector type: '%s' is not a recognized type", buffer);
1061
1062
options->v_type=type;
1062
1063
return true;
1063
1064
}
1064
1065
1065
-
if (strncasecmp(key, OPTION_KEY_DIMENSION, key_len) ==0) {
1066
+
if (KEY_MATCH(OPTION_KEY_DIMENSION)) {
1066
1067
intdimension= (int)strtol(buffer, NULL, 0);
1067
1068
if (dimension <= 0) returncontext_result_error(context, SQLITE_ERROR, "Invalid vector dimension: expected a positive integer, got '%s'", buffer);
1068
1069
options->v_dim=dimension;
1069
1070
return true;
1070
1071
}
1071
1072
1072
-
if (strncasecmp(key, OPTION_KEY_NORMALIZED, key_len) ==0) {
1073
+
if (KEY_MATCH(OPTION_KEY_NORMALIZED)) {
1073
1074
intnormalized= (int)strtol(buffer, NULL, 0);
1074
1075
options->v_normalized= (normalized!=0);
1075
1076
return true;
1076
1077
}
1077
1078
1078
-
if (strncasecmp(key, OPTION_KEY_MAXMEMORY, key_len) ==0) {
1079
+
if (KEY_MATCH(OPTION_KEY_MAXMEMORY)) {
1079
1080
uint64_tmax_memory=human_to_number(buffer);
1080
1081
if (max_memory>0) options->max_memory=max_memory;
1081
1082
return true;
1082
1083
}
1083
1084
1084
-
if (strncasecmp(key, OPTION_KEY_QUANTTYPE, key_len) ==0) {
1085
+
if (KEY_MATCH(OPTION_KEY_QUANTTYPE)) {
1085
1086
vector_qtypetype=quant_name_to_type(buffer);
1086
1087
if ((int)type==-1) returncontext_result_error(context, SQLITE_ERROR, "Invalid quantization type: '%s' is not a recognized or supported quantization type", buffer);
1087
1088
options->q_type=type;
1088
1089
return true;
1089
1090
}
1090
1091
1091
-
if (strncasecmp(key, OPTION_KEY_DISTANCE, key_len) ==0) {
(is_without_rowid) ? context_result_error(context, SQLITE_NOMEM, "Out of memory: unable to duplicate rowid column name") : context_result_error(context, SQLITE_ERROR, "WITHOUT ROWID table '%s' must have exactly one PRIMARY KEY column of type INTEGER", table_name);
1195
+
(is_without_rowid) ? context_result_error(context, SQLITE_ERROR, "WITHOUT ROWID table '%s' must have exactly one PRIMARY KEY column of type INTEGER", table_name) : context_result_error(context, SQLITE_NOMEM, "Out of memory: unable to duplicate rowid column name");
1195
1196
sqlite3_free(t_name);
1196
1197
sqlite3_free(c_name);
1197
1198
return;
@@ -1945,11 +1946,13 @@ static int vCursorFilterCommon (sqlite3_vtab_cursor *cur, int idxNum, const char
if (!name|| !sqlite_table_exists(vtab->db, name)) {
1964
1967
sqlite_vtab_set_error(&vtab->base, "Quantization table not found for table '%s' and column '%s'. Ensure that vector_quantize() has been called before using vector_quantize_scan()", table_name, column_name);
1968
+
if (vector_allocated) sqlite3_free((void*)vector);
0 commit comments