Fix minor build errors
Bug: 76169489
Change-Id: I2f59a3f27e7f4ed7820ff6aae48ba7c3a2e25ae4
diff --git a/include/perfetto/protozero/proto_decoder.h b/include/perfetto/protozero/proto_decoder.h
index c6ef7e5..fccef59 100644
--- a/include/perfetto/protozero/proto_decoder.h
+++ b/include/perfetto/protozero/proto_decoder.h
@@ -35,7 +35,7 @@
struct Field {
struct LengthDelimited {
const uint8_t* data;
- uint64_t length;
+ size_t length;
};
uint32_t id = 0;
@@ -91,7 +91,7 @@
private:
const uint8_t* const buffer_;
- const uint64_t length_;
+ const uint64_t length_; // The outer buffer can be larger than 4GB.
const uint8_t* current_position_ = nullptr;
};
diff --git a/src/protozero/proto_decoder.cc b/src/protozero/proto_decoder.cc
index eab565d..2e2754e 100644
--- a/src/protozero/proto_decoder.cc
+++ b/src/protozero/proto_decoder.cc
@@ -19,6 +19,7 @@
#include <string.h>
#include "perfetto/base/logging.h"
+#include "perfetto/protozero/proto_utils.h"
namespace protozero {
@@ -111,7 +112,8 @@
}
pos = new_pos;
field.length_limited.data = pos;
- field.length_limited.length = field_intvalue;
+ PERFETTO_CHECK(field_intvalue < proto_utils::kMaxMessageLength);
+ field.length_limited.length = static_cast<size_t>(field_intvalue);
pos += field_intvalue;
break;
}
diff --git a/src/trace_processor/sched_slice_table.cc b/src/trace_processor/sched_slice_table.cc
index 25e5bfd..33b54f3 100644
--- a/src/trace_processor/sched_slice_table.cc
+++ b/src/trace_processor/sched_slice_table.cc
@@ -437,7 +437,7 @@
return Compare(f_group, s_group, ob.desc);
}
}
- return 0;
+ PERFETTO_FATAL("Unexepcted column %d", ob.column);
}
void SchedSliceTable::PerCpuState::Initialize(