replay: fix potential timestamp parsing error in Route::load (#35117)

Fix potential timestamp parsing error in Route::load
pull/35123/head
Dean Lee 4 months ago committed by GitHub
parent db6832762b
commit 8c8b2c4488
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 6
      tools/replay/route.cc
  2. 2
      tools/replay/route.h

@ -50,9 +50,11 @@ bool Route::load() {
return false;
}
// Parse the timestamp from the route identifier (only applicable for old route formats).
struct tm tm_time = {0};
strptime(route_.timestamp.c_str(), "%Y-%m-%d--%H-%M-%S", &tm_time);
date_time_ = mktime(&tm_time);
if (strptime(route_.timestamp.c_str(), "%Y-%m-%d--%H-%M-%S", &tm_time)) {
date_time_ = mktime(&tm_time);
}
bool ret = data_dir_.empty() ? loadFromServer() : loadFromLocal();
if (ret) {

@ -59,7 +59,7 @@ protected:
RouteIdentifier route_ = {};
std::string data_dir_;
std::map<int, SegmentFile> segments_;
std::time_t date_time_;
std::time_t date_time_ = 0;
RouteLoadError err_ = RouteLoadError::None;
};

Loading…
Cancel
Save