Skip to content
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 ann-bench dataset blob integer overflow leading to incorrect data copy beyond 4B elems #671

Conversation

achirkin
Copy link
Contributor

@achirkin achirkin commented Feb 7, 2025

ann-bench keeps data dimensions as uint32_t. We use std::fread to copy the data from a file to the host memory and pass n_rows * n_cols there, which gets casted to size_t only after the multiplication. This leads to integer overflow for the datasets larger than 4B elements and a partial data copy.

This PR fixes the bug by casting the dimensions before the multiplication.
The bug only affects the benchmark cases where the data is requested in the host memory not backed by a file.

@achirkin achirkin added bug Something isn't working non-breaking Introduces a non-breaking change labels Feb 7, 2025
@achirkin achirkin self-assigned this Feb 7, 2025
@achirkin achirkin requested a review from a team as a code owner February 7, 2025 07:34
@github-actions github-actions bot added the cpp label Feb 7, 2025
@achirkin achirkin changed the title Fix ann-bench dataset blob integer overflow leading to incorrect data copy beyond 4GB Fix ann-bench dataset blob integer overflow leading to incorrect data copy beyond 4B elems Feb 7, 2025
Copy link
Contributor

@tfeher tfeher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Artem for the fix, it works!

@cjnolet
Copy link
Member

cjnolet commented Feb 7, 2025

/merge

@rapids-bot rapids-bot bot merged commit f15c1ea into rapidsai:branch-25.02 Feb 7, 2025
66 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cpp non-breaking Introduces a non-breaking change
Projects
Development

Successfully merging this pull request may close these issues.

3 participants