resolve merge conflicts of 70b9a03 to nyc-mr2-dev-plus-aosp
Change-Id: If543d1c9f9ae22a2803e16d257531335b2995a96
diff --git a/include/binder/Parcel.h b/include/binder/Parcel.h
index 74e75d7..bd2213d 100644
--- a/include/binder/Parcel.h
+++ b/include/binder/Parcel.h
@@ -681,8 +681,16 @@
return UNEXPECTED_NULL;
}
+ if (val->max_size() < size) {
+ return NO_MEMORY;
+ }
+
val->resize(static_cast<size_t>(size));
+ if (val->size() < size) {
+ return NO_MEMORY;
+ }
+
for (auto& v: *val) {
status = (this->*read_func)(&v);