-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
FIX out of bounds error on X_indptr in kmeans #21662
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
FIX out of bounds error on X_indptr in kmeans #21662
Conversation
I don't suppose we can actually test this @lorentzenchr 😁 |
I think it makes sense but I don't understand how it never triggered a segfault |
IIUC, it does not really read/access the last element. Segfaults are just hard to pin down anyway. |
So I tested this snippet
with In summary, the current code works but in a non-intuitive way |
Reference Issues/PRs
When compiled with
boundscheck=True
, Kmeans tests liketest_kmeans_results
throwsWhat does this implement/fix? Explain your changes.
A CSR matrix
X
withn
rows, hasX.indptr
withn+1
elements as beautifully explained in https://stackoverflow.com/a/52299730/16761084.The
n+1
th element might never be accessed such that this is not a user visible bug.Any other comments?
Found by working on #21654.