Skip to content

Commit

Permalink
Fix: Undefined behaviour on duplicate labels
Browse files Browse the repository at this point in the history
  • Loading branch information
ashvardanian committed Jul 25, 2023
1 parent 44c0318 commit c04a5cc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ Linux • MacOS • Windows • Docker • WebAssembly
-[View large indexes from disk](#disk-based-indexes) without loading into RAM.
- ✅ Space-efficient point-clouds with `uint40_t`, accommodating 4B+ size.
- ✅ Compatible with OpenMP and custom "executors", for fine-grained control over CPU utilization.
- ✅ Supports multiple vectors per label.
- ✅ On-the-fly deletions.
-[Semantic Search](#usearch--ai--multi-modal-semantic-search) and [Joins](#joins).

Expand Down
4 changes: 4 additions & 0 deletions include/usearch/index_punned_dense.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,10 @@ class index_punned_dense_gt {

template <typename scalar_at>
add_result_t add_(label_t label, scalar_at const* vector, add_config_t config, cast_t const& cast) {

if (contains(label))
return add_result_t{}.failed("Duplicate labels not allowed in high-level wrappers");

byte_t const* vector_data = reinterpret_cast<byte_t const*>(vector);
std::size_t vector_bytes = scalar_words_ * sizeof(scalar_at);

Expand Down

0 comments on commit c04a5cc

Please sign in to comment.