diff --git a/loadgen/loadgen.cc b/loadgen/loadgen.cc index 134670727..f745a6c59 100644 --- a/loadgen/loadgen.cc +++ b/loadgen/loadgen.cc @@ -603,7 +603,7 @@ std::vector GenerateLoadableSets( // of samples_per_query, while enabling samples in a query to be contiguous. for (auto& loadable_set : result) { auto& set = loadable_set.set; - for (size_t i = 0; i < set_padding; i++) { + for (size_t i = 0; i < std::min(set_padding , set.size() ); i++) { // It's not clear in the spec if the STL deallocates the old container // before assigning, which would invalidate the source before the // assignment happens. Even though we should have reserved enough