Trusty test app.
Note that this code is in the wrong place. The right place is still
begin created so I'm putting them here for now. We'll move them when
it's ready.
Change-Id: Iab7384a531fd4a935dbeef0aebf2652eb06f6e03
diff --git a/authorization_set.cpp b/authorization_set.cpp
index 2111b74..9d26968 100644
--- a/authorization_set.cpp
+++ b/authorization_set.cpp
@@ -32,7 +32,7 @@
const size_t STARTING_ELEMS_CAPACITY = 8;
AuthorizationSet::AuthorizationSet(const AuthorizationSet& set)
- : elems_(NULL), indirect_data_(NULL) {
+ : Serializable(), elems_(NULL), indirect_data_(NULL) {
Reinitialize(set.elems_, set.elems_size_);
}
@@ -362,7 +362,8 @@
// Note that the following validation of elements_count is weak, but it prevents allocation of
// elems_ arrays which are clearly too large to be reasonable.
- if (elements_size > end - *buf_ptr || elements_count * sizeof(uint32_t) > elements_size) {
+ if (static_cast<ptrdiff_t>(elements_size) > end - *buf_ptr ||
+ elements_count * sizeof(uint32_t) > elements_size) {
set_invalid(MALFORMED_DATA);
return false;
}