-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: Segfault when dimensions of added vector don't add up (Rust) #412
Comments
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.
I added a test for the seg fault example however this passes for me.
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 |
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
[email protected]
Are you open to being tagged as a contributor?
.git
history as a contributorIs there an existing issue for this?
Code of Conduct
The text was updated successfully, but these errors were encountered: