Skip to content

Commit

Permalink
Fix ann-bench dataset blob integer overflow leading to incorrect data…
Browse files Browse the repository at this point in the history
… copy beyond 4GB
  • Loading branch information
achirkin committed Feb 7, 2025
1 parent 4b289a0 commit a444bb5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cpp/bench/ann/src/common/blob.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,8 @@ struct blob_mmap {
size_t size = data_end - data_start;
mmap_owner owner{size, flags};
std::fseek(file_.descriptor().value(), data_start, SEEK_SET);
size_t n_elems = file_.rows_limit() * file_.n_cols();
auto n_elems =
static_cast<size_t>(file_.rows_limit()) * static_cast<size_t>(file_.n_cols());
if (std::fread(owner.data(), sizeof(T), n_elems, file_.descriptor().value()) != n_elems) {
throw std::runtime_error{"cuvs::bench::blob_mmap() fread " + file_.path() + " failed"};
}
Expand Down

0 comments on commit a444bb5

Please sign in to comment.