Fix out of bound vector access in logfile_utils_test
Caught by asan. Looks like we forgot to update a constant, better to
just remove it.
Change-Id: Ifcdb87de122e58c7c2d73308691453b453ce2b1a
Signed-off-by: Austin Schuh <austin.schuh@bluerivertech.com>
diff --git a/aos/events/logging/logfile_utils_test.cc b/aos/events/logging/logfile_utils_test.cc
index e99db94..763bb7f 100644
--- a/aos/events/logging/logfile_utils_test.cc
+++ b/aos/events/logging/logfile_utils_test.cc
@@ -453,12 +453,10 @@
unlink(logfile1_.c_str());
unlink(logfile2_.c_str());
unlink(logfile3_.c_str());
- queue_index_.resize(kChannels);
+ queue_index_.resize(config_.message().channels()->size());
}
protected:
- static constexpr size_t kChannels = 3u;
-
flatbuffers::DetachedBuffer MakeLogMessage(
const aos::monotonic_clock::time_point monotonic_now, int channel_index,
int value) {
@@ -473,6 +471,7 @@
context.realtime_event_time = aos::realtime_clock::epoch() +
chrono::seconds(1000) +
monotonic_now.time_since_epoch();
+ CHECK_LT(static_cast<size_t>(channel_index), queue_index_.size());
context.queue_index = queue_index_[channel_index];
context.size = message_fbb.GetSize();
context.data = message_fbb.GetBufferPointer();