Fix minor build errors
Bug: 76169489
Change-Id: I2f59a3f27e7f4ed7820ff6aae48ba7c3a2e25ae4
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;
}