From 0ff703d82fd6d93f8d260d7aa40e24c5146a0775 Mon Sep 17 00:00:00 2001 From: Dean Lee Date: Mon, 5 Dec 2022 03:28:40 +0800 Subject: [PATCH] Replay: fix SEGFAULT in buildTimeline if segments are not continuous. (#26691) fix segfault in buildtimeline --- tools/replay/replay.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/replay/replay.cc b/tools/replay/replay.cc index 1464a6cf57..339e688be1 100644 --- a/tools/replay/replay.cc +++ b/tools/replay/replay.cc @@ -123,9 +123,9 @@ void Replay::buildTimeline() { uint64_t alert_begin = 0; TimelineType alert_type = TimelineType::None; - for (int i = 0; i < segments_.size() && !exit_; ++i) { + for (auto it = segments_.cbegin(); it != segments_.cend() && !exit_; ++it) { LogReader log; - if (!log.load(route_->at(i).qlog.toStdString(), &exit_, + if (!log.load(route_->at(it->first).qlog.toStdString(), &exit_, {cereal::Event::Which::CONTROLS_STATE, cereal::Event::Which::USER_FLAG}, !hasFlag(REPLAY_FLAG_NO_FILE_CACHE), 0, 3)) continue;