Open jbrummack opened 1 month ago
Nice! Any chance you could open a PR?
I will look into it tomorrow, maybe this error happens with other functions too...
Another reason for segfaults is trying to add to the index when its capacity is 0 (not reserving). This could also be checked in the add function.
This one is harder to justify as it's not a zero-cost change. The size is an atomic variable, and checking it from many threads would cause contention.
I'm taking a look at this. Currently the rust tests are failing on add.
test tests::test_add_remove_vector ... thread 'tests::test_add_remove_vector' panicked at rust/lib.rs:1434:9:
assertion failed: index.add(id2, &second).is_ok()
I added a test for the seg fault example however this passes for me.
index.add(row as u64, &[3, 5]); //2 is not 192 and causes a segfault
I've added tests for other permutations of add and have hit a hang.
@MarkReedZ, check #413 🤗
I'm looking at an unrelated error and cleaning up the tests to be more rust idiomatic.
However, looking at the PR - are you suggesting fixing this in the base library by adding a size_t length argument to index::add then checking to ensure it matches options.dimensions? Or only fixing this for rust by updating rust/lib.cpp?
I meant changing only the rust/lib.cpp
🤗
Describe the bug
Hello! I am running into
zsh: segmentation fault cargo run --release combined_vectors.csv
, which is unexpected when using only safe Rust. Apparently my CSV had some messed up columns that had malformed data, yielding an input vector that is too short, causing a segfault. Is it a good idea to check if the dimensions add up in the rust library, outputting an error as value? Did I miss something?Thank You!
Steps to reproduce
Expected behavior
usearch/rust/lib.rs This is the code that is called when the crash occurs:
to handle the error gracefully add in another condition:
USearch version
usearch = { version = "2.12.0" }
Operating System
MacOS Sonoma 14.4.1
Hardware architecture
Arm
Which interface are you using?
Other bindings
Contact Details
awnings.truces0n@icloud.com
Are you open to being tagged as a contributor?
.git
history as a contributorIs there an existing issue for this?
Code of Conduct