commit | 5d8b4838a37f8da2ead583efb21a16a61e28f1c3 | [log] [tgz] |
---|---|---|
author | Lalit Maganti <lalitm@google.com> | Wed Nov 28 19:11:19 2018 +0000 |
committer | Lalit Maganti <lalitm@google.com> | Wed Nov 28 19:11:19 2018 +0000 |
tree | 49c56dc6a217a822120032f77ac3c73ed095f2e7 | |
parent | 5403e4fde106e2090e50e6e40ffd95b71a18d4a2 [diff] |
perfetto: fix MSAN bugs in ftrace muxer Off-by-one error and uninitialized mock event. Change-Id: Iba80854f9bbd8d54df48fe0f75877a37650587ca
diff --git a/src/traced/probes/ftrace/ftrace_config_muxer_unittest.cc b/src/traced/probes/ftrace/ftrace_config_muxer_unittest.cc index 399af68..f76b7ae 100644 --- a/src/traced/probes/ftrace/ftrace_config_muxer_unittest.cc +++ b/src/traced/probes/ftrace/ftrace_config_muxer_unittest.cc
@@ -206,6 +206,7 @@ Event event_to_return; event_to_return.name = "cpu_frequency"; event_to_return.group = "power"; + event_to_return.ftrace_event_id = 1; ON_CALL(*mock_table, GetOrCreateEvent(GroupAndName("power", "cpu_frequency"))) .WillByDefault(Return(&event_to_return)); EXPECT_CALL(*mock_table,
diff --git a/src/traced/probes/ftrace/proto_translation_table.cc b/src/traced/probes/ftrace/proto_translation_table.cc index c158aa5..4a0f365 100644 --- a/src/traced/probes/ftrace/proto_translation_table.cc +++ b/src/traced/probes/ftrace/proto_translation_table.cc
@@ -506,7 +506,7 @@ } bool EventFilter::IsEventEnabled(size_t ftrace_event_id) const { - if (ftrace_event_id == 0 || ftrace_event_id > enabled_ids_.size()) + if (ftrace_event_id == 0 || ftrace_event_id >= enabled_ids_.size()) return false; return enabled_ids_[ftrace_event_id]; }