mirror of
https://github.com/asg017/sqlite-vec.git
synced 2026-04-25 00:36:56 +02:00
Reject IVF binary quantizer when dimensions not divisible by 8
The binary quantizer uses D/8 for buffer sizes and memset, which truncates for non-multiple-of-8 dimensions, causing OOB writes. Rather than using ceiling division, enforce the constraint at table creation time with a clear parse error. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
5e4c557f93
commit
4bee88384b
2 changed files with 20 additions and 0 deletions
|
|
@ -3074,6 +3074,9 @@ int vec0_parse_vector_column(const char *source, int source_length,
|
|||
if (rc != SQLITE_OK) {
|
||||
return SQLITE_ERROR;
|
||||
}
|
||||
if (ivfConfig.quantizer == VEC0_IVF_QUANTIZER_BINARY && (dimensions % 8) != 0) {
|
||||
return SQLITE_ERROR;
|
||||
}
|
||||
#else
|
||||
return SQLITE_ERROR; // IVF not compiled in
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue