Fix a potential container overflow due to assign() changing the mutant size. PiperOrigin-RevId: 540419504
diff --git a/centipede/runner.cc b/centipede/runner.cc index 277a476..a907b21 100644 --- a/centipede/runner.cc +++ b/centipede/runner.cc
@@ -707,7 +707,7 @@ const auto &input = inputs[rand_r(&seed) % num_inputs]; size_t size = std::min(input.size(), kMaxMutantSize); - mutant.assign(input.data(), input.data() + size); + std::copy(input.cbegin(), input.cbegin() + size, mutant.begin()); size_t new_size = 0; if ((custom_crossover_cb != nullptr) && rand_r(&seed) % 100 < state.run_time_flags.crossover_level) {