From d1df74cb806781e348e31307c5e73ba9cbeb7a6d Mon Sep 17 00:00:00 2001 From: yin1112 <55095824+yin1112@users.noreply.github.com> Date: Thu, 16 Feb 2023 14:02:31 +0800 Subject: [PATCH] Update loadgen.cc The size of the last query may be smaller than the padding size, which may cause the subscript to go out of bounds? --- loadgen/loadgen.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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