Skip to content

Commit d56ff50

Browse files
committed
Fix out-of-bounds access
1 parent 0c148ae commit d56ff50

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cpp/bench/ann/src/common/benchmark.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,8 @@ void bench_search(::benchmark::State& state,
381381
auto recall_calculation = [&](int start, int end, int tid) -> void {
382382
for (int i = start; i < end; ++i) {
383383
size_t i_orig_idx = batch_offset + i;
384-
size_t i_out_idx = out_offset + i;
384+
if (i_orig_idx >= gt_maps.size()) { break; }
385+
size_t i_out_idx = out_offset + i;
385386
if (i_out_idx < rows) {
386387
local_total_count[tid] += filter_pass_counts[i_orig_idx];
387388

0 commit comments

Comments
 (0)