Commit f15c1ea
authored
Fix ann-bench dataset blob integer overflow leading to incorrect data copy beyond 4B elems (#671)
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.
Authors:
- Artem M. Chirkin (https://github.com/achirkin)
Approvers:
- Tamas Bela Feher (https://github.com/tfeher)
URL: #6711 parent 4b289a0 commit f15c1ea
1 file changed
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
453 | 453 | | |
454 | 454 | | |
455 | 455 | | |
456 | | - | |
| 456 | + | |
| 457 | + | |
457 | 458 | | |
458 | 459 | | |
459 | 460 | | |
| |||
0 commit comments